Saving user data using FormsAuthenication

M

MU

Hello,

I am using FormsAuthentication to log a user into the system. When
the user authenticates, I use FormsAuhentication.RedirectFromLoginPage
(txtEmailAddress.text, False). If I would like to reference the
user's First Name or UserID in the application on other pages, what is
the best way to save that data?

Right now, I'm using Session
Session("UserID") = userDataTable.Rows(0)("UserID").ToString()

Seems when I use Session, it resets when I visit the other pages and
the data is no longer in the Session object. Is there a better way?
Do I have to tell the application that I am using Session in
web.config?

Any suggestions are welcome.
Thanks
 
G

Gregory A. Beamer

Since you are using Forms Auth, you are probably using the Membership bits
in ASP.NET. If so, you can have the user's name, etc., stored in Profile and
get it from there. I would create custom Profile objects, personally, as the
built in implementation is problematic. Very flexible, but problematic.
 

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,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top