Can only use UmbracoPageResult in the context of an Http POST when using a SurfaceController form
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.InvalidOperationException: Can only use UmbracoPageResult in the context of an Http POST when using a SurfaceController form
The error above I got after I clicked the "register" button to submit the invalid information.
[HttpPost]
public ActionResult MemberRegister(MemberRegister model)
There seem to be a lot of scenarios covered and new information etc. and Shannon from HQ has answered a lot of posts trying to help people out. So think that there might be some useful information for you in it.
CurrentUmbracoPage Error
Can only use UmbracoPageResult in the context of an Http POST when using a SurfaceController form
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.InvalidOperationException: Can only use UmbracoPageResult in the context of an Http POST when using a SurfaceController form
The error above I got after I clicked the "register" button to submit the invalid information.
[HttpPost]
public ActionResult MemberRegister(MemberRegister model)
{
if (ModelState.IsValid)
{
umMember.MemberType mt = umMember.MemberType.GetByAlias("WebsiteUser");
umMember.Member m = umMember.Member.MakeNew(model.UserName, mt, new umbraco.BusinessLogic.User(0));
m.Password = model.Password;
m.LoginName = model.UserName;
m.Email = model.Email;
m.XmlGenerate(new System.Xml.XmlDocument());
m.Save();
ViewData.Add("Username", model.UserName);
FormsAuthentication.SetAuthCookie(model.UserName, false);
return RedirectToUmbracoPage(1063); //PartialView("RegSuccess");
}
else
{
return CurrentUmbracoPage();
}
}
It's obvious that throw this error when excute "return CurrentUmbracoPage()." I don't know how to deal with it.
hope somebody can help me. Thank you very much.
Hi Michael
I think it might be worth for you to read this entire post http://our.umbraco.org/forum/developers/api-questions/37547-SurfaceController-Form-Post-with-feedback?p=3
And perhaps especially this post? http://our.umbraco.org/forum/developers/api-questions/37547-SurfaceController-Form-Post-with-feedback?p=3#comment170802
There seem to be a lot of scenarios covered and new information etc. and Shannon from HQ has answered a lot of posts trying to help people out. So think that there might be some useful information for you in it.
Hope this helps.
/Jan
is working on a reply...