ASP.NET SetAuthCookie Impersonation Help
- by rlb.usa
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).