How can I read login details from FormsAuthenticationTicket ?

F

Fresh Air Rider

Hi

I have implemented a system of Role-based Security with Forms
Authentication in my website which retrieves a comma separated list of
user roles via a SQL Server stored procedure. The system all works
fine except for one part.

If I log into the system, I get authenticated as expected. If I then
close my browser, change the "Username" and "Password" values in the
database and revisit the website, I still get authenticated
successfully.

I want to add some code, probably within the Session_Start event of
Global.asax to read the username / password values from the cookie and
ensure that they still match those in the database.

Could anyone please supply me with a code snippet (preferably in C#)
for retrieving the username and password from the
FormsAuthenticationTicket. I think that I probably need to use
FormsIdentity somewhere.

Many thanks in advance
John
 
G

Guest

once user has been in you can use HttpContext.Current.User.Identity.Name to
get his/her login 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,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top