Retrieving Forms Authentication Cookie

A

angela

Hi,

Quick question:

I have set a persistent cookie on my login page and have the following
in the web config.

<forms name="BeanAppAuth" loginUrl="Login.aspx" protection="All" />

I know I can do this:

Dim objUserIdentity As FormsIdentity
If User.Identity.IsAuthenticated Then
objUserIdentity = User.Identity
Response.Write(objUserIdentity.Name)
End If

To get the username but how do I do this via the cookie name??
Response.Cookies("BeanAppAuth").Value ??

Thanks

Angela
 
B

Brock Allen

What are you trying to do? The username is encrypted inside of the cookie,
so the way ASP.NET presents this to your code is to make User.Identity.Name
avaialble as a public API from your page.
 

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

No members online now.

Forum statistics

Threads
473,754
Messages
2,569,528
Members
45,000
Latest member
MurrayKeync

Latest Threads

Top