Ask a Question related to ASP.NET Security, Design and Development.
-
Mad Scientist Jr #1
newbie seeks User.Identity and Application_AuthenticateRequest help
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
Mad Scientist Jr Guest
-
Newbie Seeks Information
I am NOT an IT professional - just a person trying to implement an idea. I am attempting to set up a DigiChat AV/IM v5.1 chat room and seek... -
Capturing identity of the user
Hi... I have made a asp page that accepts some data from user and stores it in MS Access database. Now...I want to identify the user who filled... -
*** User.Identity.Name
After a user logging on, User.Identity.Name contains domain/logon name of the current user. How to get other information of the current user such as... -
User.Identity.Name
Hi, I am using Forms authentication -in which - I am trying to use User.Identity.Name, i am getting the user name in this field even after i... -
Old ASP Windows User Identity
Is there a way in ASP (3.0, not .NET) for me to determine who the current windows users is (i.e. the user who was authenticated and who is... -
Svein Terje Gaup #2
Re: newbie seeks User.Identity and Application_AuthenticateRequest help
This article describes how to implement Forms Authentication with roles and
a Generic Principal:
[url]http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnnetsec/html/SecNetHT04.asp[/url]
I've implemented the example from the link above, and fixed a problem with
persisting the cookie, using xml in the cookie's FormsAuthenticationTicket
to store the "persist" setting plus the roles. Also extended the example
with a user database. You can download my source + database from here:
[url]http://www.geocities.com/gaupen/index.htm?NETStuff.htm[/url]
The example is called GenericPrincipalApp.
Sincerely
Svein Terje Gaup
"Mad Scientist Jr" <usenet_daughter@yahoo.com> wrote in message
news:7a93f3c4.0405271022.75cb7ff2@posting.google.c om...rolesCookie.Value.Split('|'));> 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,> 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
Svein Terje Gaup Guest



Reply With Quote

