forked from dotnet/docs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathWebUser.xml
92 lines (77 loc) · 5.22 KB
/
WebUser.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
<Type Name="WebUser" FullName="Microsoft.VisualBasic.ApplicationServices.WebUser">
<TypeSignature Language="C#" Value="public class WebUser : Microsoft.VisualBasic.ApplicationServices.User" />
<TypeSignature Language="ILAsm" Value=".class public auto ansi WebUser extends Microsoft.VisualBasic.ApplicationServices.User" />
<TypeSignature Language="DocId" Value="T:Microsoft.VisualBasic.ApplicationServices.WebUser" />
<AssemblyInfo>
<AssemblyName>Microsoft.VisualBasic</AssemblyName>
<AssemblyVersion>10.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Base>
<BaseTypeName>Microsoft.VisualBasic.ApplicationServices.User</BaseTypeName>
</Base>
<Interfaces />
<Docs>
<summary>Provides access to the information about the current user.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The properties and methods exposed by the `My.User` object provide access to the information about the current user. The meaning of "current user" differs slightly between Windows and Web applications. In a Windows application, the current user is the user who runs the application. In a Web application, the current user is the user who accesses the application.
The `My.User` property also provides access to the <xref:System.Security.Principal.IPrincipal> for the current user. A principal object represents the user's security context, including that user's identity and any roles to which the user belongs.
For Windows applications, this property provides the same functionality as the <xref:System.Threading.Thread.CurrentPrincipal%2A> property. For Web applications, this property provides the same functionality as the <xref:System.Web.HttpContext.User%2A> property of the object returned by the <xref:System.Web.HttpContext.Current%2A> property.
> [!NOTE]
> For Windows applications, only projects built on the **Windows Application** template initialize the `My.User` object by default. In all other Windows project types, you must initialize the `My.User` object by calling the <xref:Microsoft.VisualBasic.ApplicationServices.User.InitializeWithWindowsUser%2A>method explicitly or by assigning a value to <xref:System.Threading.Thread.CurrentPrincipal%2A>.
> [!NOTE]
> The `My.User` object cannot report information about the current Windows user when run under Windows 95 and Windows 98 because those operating systems do not support the concept of a logged-on user. You must implement custom authentication to use the `My.User` object on those operating systems..
## Examples
This example checks if the application is using Windows or custom authentication, and uses that information to parse the `My.User.Name` property.
[!code-vb[VbVbalrMyUser#3](~/samples/snippets/visualbasic/VS_Snippets_VBCSharp/VbVbalrMyUser/VB/Class1.vb#3)]
]]></format>
</remarks>
</Docs>
<Members>
<Member MemberName=".ctor">
<MemberSignature Language="C#" Value="public WebUser ();" />
<MemberSignature Language="ILAsm" Value=".method public specialname rtspecialname instance void .ctor() cil managed" />
<MemberSignature Language="DocId" Value="M:Microsoft.VisualBasic.ApplicationServices.WebUser.#ctor" />
<MemberType>Constructor</MemberType>
<AssemblyInfo>
<AssemblyName>Microsoft.VisualBasic</AssemblyName>
<AssemblyVersion>10.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Parameters />
<Docs>
<summary>Initializes a new instance of the <see cref="T:Microsoft.VisualBasic.ApplicationServices.WebUser" /> class.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The properties and methods exposed by the `My.User` object provide access to the information about the current user.
]]></format>
</remarks>
</Docs>
</Member>
<Member MemberName="InternalPrincipal">
<MemberSignature Language="C#" Value="protected override System.Security.Principal.IPrincipal InternalPrincipal { get; set; }" />
<MemberSignature Language="ILAsm" Value=".property instance class System.Security.Principal.IPrincipal InternalPrincipal" />
<MemberSignature Language="DocId" Value="P:Microsoft.VisualBasic.ApplicationServices.WebUser.InternalPrincipal" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>Microsoft.VisualBasic</AssemblyName>
<AssemblyVersion>10.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Security.Principal.IPrincipal</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets or sets the principal object representing the current user.</summary>
<value>An <see cref="T:System.Security.Principal.IPrincipal" /> object representing the current user.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
In the <xref:Microsoft.VisualBasic.ApplicationServices.WebUser> object, this property wraps the <xref:System.Web.HttpContext.User%2A> property of the <xref:System.Web.HttpContext.Current%2A?displayProperty=fullName> property.
For more detailed information, see the <xref:Microsoft.VisualBasic.ApplicationServices.User.CurrentPrincipal%2A> property.
]]></format>
</remarks>
</Docs>
</Member>
</Members>
</Type>