ASP.NET SetAuthCookie weird behaviour

Posted by rlb.usa on Stack Overflow See other posts from Stack Overflow or by rlb.usa
Published on 2010-04-13T19:30:17Z Indexed on 2010/04/13 19:33 UTC
Read the original article Hit count: 365

Hello SO, I'm trying to do user impersonation for a web application we have. The user selects the user they'd like to emulate/impersonate and then clicks the button which fires this:

protected void uxImpersonate_Click(object sender, EventArgs e)
{
    ...
    FormsAuthentication.SetAuthCookie(uxUserToEmulate.SelectedValue, false);
    Response.Redirect("Impersonation.aspx"); //reload page manually
}

We have a dev -> test -> production server environment and on two servers this works just fine, but on another one, in all browsers, it kicks me to the login screen.

What's going on and how can I fix it?

We're on ASP.NET 2.0

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about formsauthentication