Can't explain why not redirecting after login using RedirectFromLogin
- by Blankman
I am using ASP.NET MVC, on my login action I am doing:
[AcceptVerbs("POST")]
public ActionResult Login(FormCollection form)
{
User validatedUser = // tests username/pwd here.
FormsAuthentication.RedirectFromLoginPage(
validatedUser.ID.ToString(), rememberMe);
if(String.IsNullOrEmpty(Request["ReturnUrl"]))
string redirectUrl = Request["ReturnUrl"];
if (!String.IsNullOrEmpty(Request.QueryString["ReturnUrl"]))
string redirectUrl = Request["ReturnUrl"];
}
My url looks like this when I am on the login page:
http://localhost:56112/user/login?ReturnUrl=/admin/settings
Does anything look wrong here?
My web.config:
<authentication mode="Forms">
<forms loginUrl="/user/login"
protection="All"
timeout="30"
name="SomeCookie"
requireSSL="false"
slidingExpiration="true"
defaultUrl="default.aspx" />