Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Security > Forms Authentication - Really really basic question

Reply
Thread Tools

Forms Authentication - Really really basic question

 
 
LW
Guest
Posts: n/a
 
      04-23-2007
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,


 
Reply With Quote
 
 
 
 
Alexey Smirnov
Guest
Posts: n/a
 
      05-02-2007
On Apr 23, 8:40 pm, LW <(E-Mail Removed)> wrote:
> 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

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Forms Authentication - Really really basic question =?Utf-8?B?TFc=?= ASP .Net 8 04-24-2007 11:54 PM
forms authentication -- expired forms cookie vs. not provided forms cookie Eric ASP .Net Security 2 01-27-2006 10:09 PM
Forms Authentication question: How to have some pages open and some requiring forms authentication Eric ASP .Net 2 02-13-2004 02:14 PM
Forms Authentication displays basic authentication dialogue window Brett Porter ASP .Net 5 02-03-2004 07:06 PM
ASP.Net Forms authentication with basic authentication popup Brett Porter ASP .Net 2 01-20-2004 02:17 PM



Advertisments