Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Michael 22 posts 61 karma points
    Jan 20, 2015 @ 07:19
    Michael
    0

    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.


  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Jan 20, 2015 @ 07:30
    Jan Skovgaard
    0

    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

Please Sign in or register to post replies

Write your reply to:

Draft