M
Mad Scientist Jr
I'm trying to understand how security works in a ASP.NET c# project.
The global.asax has this code:
protected void Application_AuthenticateRequest(Object sender,EventArgs e)
{
HttpCookie rolesCookie = Request.Cookies["roles"];
if ((!(rolesCookie==null)) && (!(Context.User==null)))
{
GenericIdentity gi = new GenericIdentity(User.Identity.Name);
GenericPrincipal gp = new GenericPrincipal(gi, rolesCookie.Value.Split('|'));
Context.User = gp;
}
}
and on another page, they get the user name from this code:
string strUserName = HttpContext.Current.User.Identity.Name;
Unfortunately, I'm missing the login screen.
How is the user name being set?
Is it possible to do something like:
HttpContext.Current.User.Identity.Name = "johndoe";
?
thanks
The global.asax has this code:
protected void Application_AuthenticateRequest(Object sender,EventArgs e)
{
HttpCookie rolesCookie = Request.Cookies["roles"];
if ((!(rolesCookie==null)) && (!(Context.User==null)))
{
GenericIdentity gi = new GenericIdentity(User.Identity.Name);
GenericPrincipal gp = new GenericPrincipal(gi, rolesCookie.Value.Split('|'));
Context.User = gp;
}
}
and on another page, they get the user name from this code:
string strUserName = HttpContext.Current.User.Identity.Name;
Unfortunately, I'm missing the login screen.
How is the user name being set?
Is it possible to do something like:
HttpContext.Current.User.Identity.Name = "johndoe";
?
thanks