HttpContext.Current.User.Identity.IsAuthenticated

Discussion in 'ASP .Net' started by paul@domainscanners.com, Oct 17, 2005.

  1. Guest

    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.
    , Oct 17, 2005
    #1
    1. Advertising

  2. 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!
    ***************************


    "" wrote:

    > 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.
    >
    >
    =?Utf-8?B?Q293Ym95IChHcmVnb3J5IEEuIEJlYW1lcikgLSBN, Oct 17, 2005
    #2
    1. Advertising

  3. 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.

    --
    Ken Dopierala Jr.
    For great ASP.Net web hosting try:
    http://www.webhost4life.com/default.asp?refid=Spinlight
    If you sign up under me and need help, email me.

    <> wrote in message
    news:...
    > 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.
    >
    Ken Dopierala Jr., Oct 17, 2005
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Giovanni Bassi
    Replies:
    0
    Views:
    638
    Giovanni Bassi
    Oct 20, 2003
  2. Bob
    Replies:
    1
    Views:
    11,945
    Joe Fallon
    Apr 29, 2004
  3. ChInKPoInt [No MCSD]
    Replies:
    0
    Views:
    802
    ChInKPoInt [No MCSD]
    Dec 4, 2004
  4. nalbayo
    Replies:
    2
    Views:
    5,491
    Bruce Barker
    Nov 11, 2005
  5. Replies:
    2
    Views:
    378
Loading...

Share This Page