ASP.NET SetAuthCookie Impersonation Help
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
20:43 UTC
Read the original article
Hit count: 342
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, and I'm using http://stackoverflow.com/questions/549016/user-impersonation-with-asp-net-forms-authentication as a guide.
UPDATE: It appears that the user actually is impersonated successfully but is loosing their Role as admin (only Admin Role's can access this impersonation page).
© Stack Overflow or respective owner