0
votes

I currently have a site where I am using Json to populate a dropdownlist based on user input.

When I goto the original site : examples.com/Account/Logon , the json executes fine. If the user inputs an invalid login MVC replaces my link to : examples.com/Account/LogOn#/Account/LogOn

None of my Json events are executes and the page doesn't work correctly.

Once I am logged in my url then becomes examples.com/Account/LogOn?ReturnUrl=%2f#/Controller

All actions after that then also use the : /Account/LogOn?ReturnUrl=%2f#/Controller logic

My route is :

 "Default", // Route name
                "{controller}/{action}/{id}", // URL with parameters
                new { controller = "Home", action = "Index", id = UrlParameter.Optional }

My Login successful code:

if (Url.IsLocalUrl(returnUrl) && returnUrl.Length > 1 && returnUrl.StartsWith("/") && !returnUrl.StartsWith("//") && !returnUrl.StartsWith("/\")) { return Redirect(returnUrl); } else { return RedirectToAction("Index", "Home"); }

My unsuccessful login is:

return View(model)
1

1 Answers

1
votes

Everything that follows the # sign (fragment) in an url is never sent to the server by the client browser. This means that the server can never fetch it. Only javascript has access to this portion of the url.