Forms Authentication - Really really basic question

L

LW

Hello!
I am just learning about forms authentication so please excuse this basic
question. I am using .NET 1.1 and C#.

I have created my web.config file and my login.aspx and the associated cs
file using
examples on MSDN. I have created a FormsAuthenticationTicket and cookie and
added the cookie to the response and then set the SetAuthCookie etc. When I
go to the redirected page, I am not sure how to read the cookie value so I
know who the user is!

In my FirstPage.aspx.cs's Page Load method, I have

string userID = Request.Cookies[FormsAuthentication.FormsCookieName].Value;

which is blank. My question is, once I read have created the ticket and
cookie, how to I read it ? Most examples I am looking at talk about the
creating tickets and cookies in forms authentication and not how to read the
cookie so any help will be greatly appreciated. Do I need to decrypt the
ticket?cookie?

Thanks,
 
G

Guest

Hello!
I am just learning about forms authentication so please excuse this basic
question. I am using .NET 1.1 and C#.

I have created my web.config file and my login.aspx and the associated cs
file using
examples on MSDN. I have created a FormsAuthenticationTicket and cookie and
added the cookie to the response and then set the SetAuthCookie etc. When I
go to the redirected page, I am not sure how to read the cookie value so I
know who the user is!

Once a user has authenticated, you can get it as

Context.User.Identity.Name
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,767
Messages
2,569,572
Members
45,046
Latest member
Gavizuho

Latest Threads

Top