I’m developing MVC3 project and have this situation. only at runtime.
I’m using the default Account controller to login. if login succeed i need to redirect to another area just somethhing like this:
if (Membership.ValidateUser(model.UserName, model.Password))
{
FormsAuthentication.SetAuthCookie(model.UserName, model.RememberMe);
SessionBag.Current.UserName = model.UserName;
if (Url.IsLocalUrl(returnUrl) && returnUrl.Length > 1 && returnUrl.StartsWith("/")
&& !returnUrl.StartsWith("//") && !returnUrl.StartsWith("/\\"))
{
return Redirect(returnUrl);
}
else
{
//Here This doesn´t work at run time.
return RedirectToAction("MenuInicial", "Menu", new { area = "Configuration" });
}
}
else
{
ModelState.AddModelError("", "The user name or password provided is incorrect.");
}
It runs ok at developing time but after publish the site doesn’t work.
My first link (It shows a welcome and provide a logon Button)
[http://localhost/mobile1]
After clicking on logonButton:
[http://localhost/mobile1#/Mobile1/Account/LogOn]
After type user and password it say
Error loading page
if manullay change the link
[http://localhost/mobile1#/Mobile1/Account/LogOn] to [localhost/mobile1/Account/LogOn]
The same error happen.
Very tks for your help.
This was a security issue, the actionresult need to write some files..
It was solved impersonatting the context to some windows valid user with the right permissions to the folder where the files need to write.
at the web.config in the section system.web add