Copied to clipboard

Flag this post as spam?

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


  • Wilson 14 posts 103 karma points
    Aug 08, 2017 @ 10:33
    Wilson
    0

    CurrentUmbracoPage return to previous view

    Hi, i have below issue related to CurrentUmbracoPage.

    1) in myLogin view got a button to execute 'DoLogin' in my controller. below is the code for 'DoLogin'

            if (ModelState.IsValid)
            {
                    TempData["LoginSuccess"] = true;
                    return RedirectToCurrentUmbracoPage();
            }
            return CurrentUmbracoPage();
    

    and this is myLogin view:

    if (TempData["LoginSuccess"] != null && (bool)TempData["LoginSuccess"])
    {
        Html.RenderAction("RenderForm", "myMember");
    }
    else
    {
        Html.RenderAction("RenderForm", "myLogin");
    }
    

    2) After the myMember page show, i have a button to execute 'DoSubmit' in my controller. below is the code :

            if (ModelState.IsValid)
            {
                ....
            }
            return CurrentUmbracoPage();
    

    when ModelState.IsValid is false, CurrentUmbracoPage() is execute, but it will display myLogin view instead of myMember view. The CurrentUmbracoPage() still point to myLogin view ???

    please help.

  • Wilson 14 posts 103 karma points
    Aug 09, 2017 @ 07:46
    Wilson
    0

    i have try many time and really don't know why the CurrentUmbracoPage() is refer to myLogin view.

    in myLoginController, CurrentUmbracoPage() is myLogin view in myMemberController, CurrentUmbracoPage() also myLogin view

    in myMemberController, when i return CurrentUmbracoPage(), i should get myMember view, but it keep give me myLogin view ???

    when login form show, user fill in user and password and click login. in controller, after validated, i code

                TempData["LoginSuccess"] = true;
                return RedirectToCurrentUmbracoPage();
    

    but in my view, i code

     if (TempData["LoginSuccess"] != null && (bool)TempData["LoginSuccess"])
     {
         Html.RenderAction("RenderForm", "myMember");
     }
    

    if i understand correctly, the page is still login page, just the view is change to myMember, so when i call CurrentUmbracoPage(), it will give me myLogin ???

Please Sign in or register to post replies

Write your reply to:

Draft