HttpContext.Current.User.Identity.IsAuthenticated

P

paul

Hi,

Quick question - does HttpContext.Current.User.Identity.IsAuthenticated
perform a hit on the database if using forms authentication?

Just wondering if I should perform this once when a user logs into my
site then store in a session as to not repeatidly hit the database as
the user navigates around my site.

Thanks v much,

Paul.
 
G

Guest

No. It simply checks the state of the Principle (has not timed out) and then
checks the authentication (successful login). It is handled partially server
side and partially client side, but does not require logging in every time
you check the property.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

***************************
Think Outside the Box!
***************************
 
K

Ken Dopierala Jr.

Hi Paul,

Greg is right it doesn't hit the database again. I just want to mention
that if you decide to use Roles you will need to hit the database everytime.
I don't think you can store those in a Session object because you need to
access them in the Global.asax file before you can access the Session. I'm
not totally sure though so you may want to do some checking before hand if
you are going to go with Roles in the future. Good luck! Ken.
 

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,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top