User Property
Collapse the table of content
Expand the table of content

Page.User Property


Gets information about the user making the page request.

Namespace:   System.Web.UI
Assembly:  System.Web (in System.Web.dll)

public IPrincipal User { get; }

Property Value

Type: System.Security.Principal.IPrincipal

An IPrincipal that represents the user making the page request.

An IPrincipal object represents the security context of the user on whose behalf the code is running, including that user's identity and any roles to which they belong.

This property uses the HttpContext object's User property to determine where the request originates.

The following code example uses the User property to access authentication and identity information for the current user. If the user is not authenticated, it redirects them to a login page.

.NET Framework
Available since 1.1
Return to top
© 2015 Microsoft