Re: HttpContext.Current.User.Identity.IsAuthenticated

From: Dominick Baier [DevelopMentor] (dbaier_at_pleasepleasenospamdevelop.com)
Date: 10/17/05


Date: Mon, 17 Oct 2005 10:20:06 -0700

Hello paul@domainscanners.com,

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



Relevant Pages

  • Re: Windows Authentification against a list of users
    ... This might be a better question posed to the aspnet security newsgroup as ... I'm kind of surprised that AuthenticateRequest gets called if the user ... >> One thing you might do would be to validate against a group in the ... >> as your list of allowed users instead of your database though. ...
    (microsoft.public.dotnet.security)
  • RE: IsInRole always returns false?
    ... after AuthenticateRequest there is a undocumented event called DefaultAuthentication ... >> I'm using Windows authentication with impersonation turned on but I ... >> wanted to pull user roles from my database. ...
    (microsoft.public.dotnet.framework.aspnet.security)
  • Re: Need to create in-memory store for authorization roles
    ... It may not be an option for you, but I've always used an encrypted cookie, this is when I use forms authentication though. ... When AuthenticateRequest comes along, I unencrypt the cookie, assign the roles, and attach it to the context. ... I know I can go get the roles from the database and add them ... > know that at the point where I need this the session state bag is not yet ...
    (microsoft.public.dotnet.framework.aspnet)