Can't explain why not redirecting after login using RedirectFromLogin

Posted by Blankman on Stack Overflow See other posts from Stack Overflow or by Blankman
Published on 2010-01-29T14:43:35Z Indexed on 2010/04/04 6:03 UTC
Read the original article Hit count: 565

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" />

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about asp.net-mvc