HttpContext.Current.User.Identity.IsAuthenticated

Discussion in 'ASP .Net Security' 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. Hello ,

    no - the IPrincipal on Context.User is created in the AuthenticateRequest
    event - you are doing a normal Property lookup.

    code for GenericIdentity:

    public virtual bool IsAuthenticated
    {
    get
    {
    return !this.m_name.Equals("");
    }
    }



    code for FormsIdentity:

    public bool IsAuthenticated
    {
    get
    {
    return true;
    }
    }


    ---------------------------------------
    Dominick Baier - DevelopMentor
    http://www.leastprivilege.com

    > 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.
    >
    Dominick Baier [DevelopMentor], Oct 17, 2005
    #2
    1. Advertising

  3. Guest

    Thanks v much Dominick
    , 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:
    637
    Giovanni Bassi
    Oct 20, 2003
  2. Bob
    Replies:
    1
    Views:
    11,942
    Joe Fallon
    Apr 29, 2004
  3. ChInKPoInt [No MCSD]
    Replies:
    0
    Views:
    802
    ChInKPoInt [No MCSD]
    Dec 4, 2004
  4. Replies:
    2
    Views:
    5,860
    Ken Dopierala Jr.
    Oct 17, 2005
  5. nalbayo
    Replies:
    2
    Views:
    5,491
    Bruce Barker
    Nov 11, 2005
Loading...

Share This Page