Httpcontext.current.user windowsprincipal




















Name to get the name of the user on whose behalf the current process is running. NET code-behind module, you must include a reference to the System.

Web that you want to use. For example, in a code-behind page you must specify the fully qualified name HttpContext. Skip to main content. This browser is no longer supported. Download Microsoft Edge More info. Contents Exit focus mode. Http Context. The RIDs are used to determine the roles of the current principal.

The WindowsPrincipal class is primarily used to check the role of a Windows user. The WindowsPrincipal. IsInRole method overloads let you check the user role by using different role contexts. Initializes a new instance of the WindowsPrincipal class by using the specified WindowsIdentity object. Gets a collection that contains all of the claims from all of the claims identities associated with this claims principal. Contains any additional data provided by a derived type.

Gets a collection that contains all of the claims identities associated with this claims principal. Populates the SerializationInfo with data needed to serialize the current ClaimsPrincipal object. Gets the Type of the current instance. Determines whether any of the claims identities associated with this claims principal contains a claim that is matched by the specified predicate. Determines whether any of the claims identities associated with this claims principal contains a claim with the specified claim type and value.

Determines whether the current principal belongs to the Windows user group with the specified relative identifier RID. Determines whether the current principal belongs to the Windows user group with the specified security identifier SID.

Determines whether the current principal belongs to the Windows user group with the specified name. Determines whether the current principal belongs to the Windows user group with the specified WindowsBuiltInRole. Creates a shallow copy of the current Object.

Serializes using a BinaryWriter. Skip to main content. This browser is no longer supported. Disclaimer: The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way. Sponsored By. About Scott Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee.

About Newsletter. Hosting By. Share on Twitter or Facebook or use the Permalink. September 09, User; Peter. Hey Scott, Another caveat. You said "When the first chunk of code runs in the Global. This isn't entirely true. When you set the HttpContext. User to your custom IPrincipal in the Global. We hit this exact scenario ourselves. I'll have to do a little more research, but basically sometime after the Global. NET sets the Thread. CurrentPrincipal to the same principal as HttpContext.

Lesson: Even in Global. User and Thread. CurrentPrincipal to your custom IPrincipal. Jason Langston. Wow, so now I'm confused. I understand what you're saying, Jason, and that's the line of code in red that I'm adding.

However, I don't understand what Peter is saying. NET is going to set that Thread's Current Principal "after AuthenticateRequest" anyway using the same line of code so why are you Peter saying never to do that?

Additional thought: Perhaps in EndRequest or somewhere this Principal should be blown away or is it already for security reasons? Scott Hanselman.

Yeah, I'm still confused on Peter's point. I did some more Reflector spelunking and found where "ASP.



0コメント

  • 1000 / 1000