ASP.NET MVC Razor Layouts - the url is not getting

2019-04-23 09:23发布

问题:

I'm pretty new to ASP.NET MVC so peace if I'm asking something stupid. The problem is, when I'm redirecting from the LogOn method it does not update the URL in the browser properly

 public ActionResult LogOn(LogOnModel model, string returnUrl)
        {
          return RedirectToAction("Index", "Menu");
        }

and although it renders the content from the Menu/Index view, the url remains

http://localhost/App/account/logon#/WMSMobileWeb/account/logon

where it should have been,

http://localhost/App/Menu/Index

I'm using Razor view engine with Layouts and with JQuryMobile. Any idea?

/Bumble Bee

回答1:

It seems, that you are calling this action using Ajax, that's why your URL doesn't change. This question basically covers what you need to do redirects with Ajax approach