/
ClientFormsIdentity.xml
431 lines (400 loc) · 35.2 KB
/
ClientFormsIdentity.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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
<Type Name="ClientFormsIdentity" FullName="System.Web.ClientServices.ClientFormsIdentity">
<TypeSignature Language="C#" Value="public class ClientFormsIdentity : IDisposable, System.Security.Principal.IIdentity" />
<TypeSignature Language="ILAsm" Value=".class public auto ansi beforefieldinit ClientFormsIdentity extends System.Object implements class System.IDisposable, class System.Security.Principal.IIdentity" />
<TypeSignature Language="DocId" Value="T:System.Web.ClientServices.ClientFormsIdentity" />
<TypeSignature Language="VB.NET" Value="Public Class ClientFormsIdentity
Implements IDisposable, IIdentity" />
<TypeSignature Language="F#" Value="type ClientFormsIdentity = class
 interface IIdentity
 interface IDisposable" />
<TypeSignature Language="C++ CLI" Value="public ref class ClientFormsIdentity : IDisposable, System::Security::Principal::IIdentity" />
<AssemblyInfo>
<AssemblyName>System.Web.Extensions</AssemblyName>
<AssemblyVersion>3.5.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Base>
<BaseTypeName>System.Object</BaseTypeName>
</Base>
<Interfaces>
<Interface>
<InterfaceName>System.IDisposable</InterfaceName>
</Interface>
<Interface>
<InterfaceName>System.Security.Principal.IIdentity</InterfaceName>
</Interface>
</Interfaces>
<Docs>
<summary>Represents a user identity authenticated for client application services by using forms authentication.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The client application services feature uses this class to represent an authenticated user. When you configure your application to use client application services and forms authentication, you can authenticate a user by calling the `static` <xref:System.Web.Security.Membership.ValidateUser%2A?displayProperty=nameWithType> method. After authentication, you can retrieve a reference to the current <xref:System.Web.ClientServices.ClientFormsIdentity> instance through the <xref:System.Security.Principal.IPrincipal.Identity%2A> property of the <xref:System.Security.Principal.IPrincipal> retrieved through the `static` <xref:System.Threading.Thread.CurrentPrincipal%2A?displayProperty=nameWithType> property. For more information, see [Client Application Services](/dotnet/framework/common-client-technologies/client-application-services).
You will typically access a <xref:System.Web.ClientServices.ClientFormsIdentity> object as an <xref:System.Security.Principal.IIdentity> reference to avoid a direct dependency on this class. You can determine whether a user is authenticated by checking the <xref:System.Security.Principal.IIdentity.IsAuthenticated%2A?displayProperty=nameWithType> property of the identity. However, the user may be authenticated for Windows, but not for client application services. To determine whether the user is authenticated for client application services, you should also confirm that the <xref:System.Security.Principal.IIdentity.AuthenticationType%2A?displayProperty=nameWithType> property value is "ClientForms".
You must use an explicit <xref:System.Web.ClientServices.ClientFormsIdentity> reference to call the <xref:System.Web.ClientServices.ClientFormsIdentity.RevalidateUser%2A> method, which is not defined by the <xref:System.Security.Principal.IIdentity> interface.
## Examples
The following example code demonstrates how to use this class to silently revalidate a user when the application leaves the offline state. In this example, a <xref:System.Windows.Forms.CheckBox.CheckedChanged> event handler updates the offline status to match the check box value. If the user sets the application to the online state, the event handler attempts to revalidate the user by calling the <xref:System.Web.ClientServices.ClientFormsIdentity.RevalidateUser%2A> method. However, if the authentication server is unavailable, the event handler returns the application to the offline state.
> [!NOTE]
> The <xref:System.Web.ClientServices.ClientFormsIdentity.RevalidateUser%2A> method is for convenience only. Because it does not have a return value, it cannot indicate whether revalidation has failed. Revalidation can fail, for example, if the user credentials have changed on the server. In this case, you might want to include code that explicitly validates users after a service call fails. For more information, see the Accessing Web Settings section in [Walkthrough: Using Client Application Services](/dotnet/framework/common-client-technologies/walkthrough-using-client-application-services).
:::code language="csharp" source="~/snippets/csharp/System.Web.ClientServices/ClientFormsIdentity/Overview/Class1.cs" id="Snippet315":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Winforms/ClientApplicationServices/VB/Class1.vb" id="Snippet315":::
]]></format>
</remarks>
<altmember cref="M:System.Web.Security.Membership.ValidateUser(System.String,System.String)" />
<altmember cref="M:System.Web.ClientServices.ClientFormsIdentity.RevalidateUser" />
<altmember cref="P:System.Threading.Thread.CurrentPrincipal" />
<altmember cref="T:System.Security.Principal.IPrincipal" />
<altmember cref="P:System.Security.Principal.IPrincipal.Identity" />
<altmember cref="T:System.Security.Principal.IIdentity" />
<altmember cref="P:System.Security.Principal.IIdentity.IsAuthenticated" />
<altmember cref="P:System.Web.ClientServices.ClientFormsIdentity.IsAuthenticated" />
<altmember cref="P:System.Web.ClientServices.ClientFormsIdentity.AuthenticationType" />
<altmember cref="M:System.Web.ClientServices.Providers.ClientFormsAuthenticationMembershipProvider.Logout" />
<related type="Article" href="https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2010/bb384297(v=vs.100)">Client Application Services</related>
<related type="Article" href="https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2010/bb546195(v=vs.100)">Walkthrough: Using Client Application Services</related>
</Docs>
<Members>
<Member MemberName=".ctor">
<MemberSignature Language="C#" Value="public ClientFormsIdentity (string name, string password, System.Web.Security.MembershipProvider provider, string authenticationType, bool isAuthenticated, System.Net.CookieContainer authenticationCookies);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(string name, string password, class System.Web.Security.MembershipProvider provider, string authenticationType, bool isAuthenticated, class System.Net.CookieContainer authenticationCookies) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Web.ClientServices.ClientFormsIdentity.#ctor(System.String,System.String,System.Web.Security.MembershipProvider,System.String,System.Boolean,System.Net.CookieContainer)" />
<MemberSignature Language="VB.NET" Value="Public Sub New (name As String, password As String, provider As MembershipProvider, authenticationType As String, isAuthenticated As Boolean, authenticationCookies As CookieContainer)" />
<MemberSignature Language="F#" Value="new System.Web.ClientServices.ClientFormsIdentity : string * string * System.Web.Security.MembershipProvider * string * bool * System.Net.CookieContainer -> System.Web.ClientServices.ClientFormsIdentity" Usage="new System.Web.ClientServices.ClientFormsIdentity (name, password, provider, authenticationType, isAuthenticated, authenticationCookies)" />
<MemberSignature Language="C++ CLI" Value="public:
 ClientFormsIdentity(System::String ^ name, System::String ^ password, System::Web::Security::MembershipProvider ^ provider, System::String ^ authenticationType, bool isAuthenticated, System::Net::CookieContainer ^ authenticationCookies);" />
<MemberType>Constructor</MemberType>
<AssemblyInfo>
<AssemblyName>System.Web.Extensions</AssemblyName>
<AssemblyVersion>3.5.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Parameters>
<Parameter Name="name" Type="System.String" />
<Parameter Name="password" Type="System.String" />
<Parameter Name="provider" Type="System.Web.Security.MembershipProvider" />
<Parameter Name="authenticationType" Type="System.String" />
<Parameter Name="isAuthenticated" Type="System.Boolean" />
<Parameter Name="authenticationCookies" Type="System.Net.CookieContainer" />
</Parameters>
<Docs>
<param name="name">The name of the authenticated user.</param>
<param name="password">The password of the authenticated user.</param>
<param name="provider">The membership provider used to authenticate the user.</param>
<param name="authenticationType">The type of authentication that is used.</param>
<param name="isAuthenticated">
<see langword="true" /> if the user has been authenticated; otherwise, <see langword="false" />.</param>
<param name="authenticationCookies">The cookies retrieved from the authentication service.</param>
<summary>Initializes a new instance of the <see cref="T:System.Web.ClientServices.ClientFormsIdentity" /> class.</summary>
<remarks>To be added.</remarks>
<related type="Article" href="https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2010/bb384297(v=vs.100)">Client Application Services</related>
</Docs>
</Member>
<Member MemberName="AuthenticationCookies">
<MemberSignature Language="C#" Value="public System.Net.CookieContainer AuthenticationCookies { get; }" />
<MemberSignature Language="ILAsm" Value=".property instance class System.Net.CookieContainer AuthenticationCookies" />
<MemberSignature Language="DocId" Value="P:System.Web.ClientServices.ClientFormsIdentity.AuthenticationCookies" />
<MemberSignature Language="VB.NET" Value="Public ReadOnly Property AuthenticationCookies As CookieContainer" />
<MemberSignature Language="F#" Value="member this.AuthenticationCookies : System.Net.CookieContainer" Usage="System.Web.ClientServices.ClientFormsIdentity.AuthenticationCookies" />
<MemberSignature Language="C++ CLI" Value="public:
 property System::Net::CookieContainer ^ AuthenticationCookies { System::Net::CookieContainer ^ get(); };" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Web.Extensions</AssemblyName>
<AssemblyVersion>3.5.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-4.0">
<AttributeName Language="C#">[get: System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")]</AttributeName>
<AttributeName Language="F#">[<get: System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")>]</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Net.CookieContainer</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets a collection of the cookies retrieved from the authentication service.</summary>
<value>The cookies retrieved from the authentication service.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
This property is not meant for use in your application code. You cannot meaningfully modify the cookies retrieved through this property, and they contain no useful information.
]]></format>
</remarks>
<related type="Article" href="https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2010/bb384297(v=vs.100)">Client Application Services</related>
</Docs>
</Member>
<Member MemberName="AuthenticationType">
<MemberSignature Language="C#" Value="public string AuthenticationType { get; }" />
<MemberSignature Language="ILAsm" Value=".property instance string AuthenticationType" />
<MemberSignature Language="DocId" Value="P:System.Web.ClientServices.ClientFormsIdentity.AuthenticationType" />
<MemberSignature Language="VB.NET" Value="Public ReadOnly Property AuthenticationType As String" />
<MemberSignature Language="F#" Value="member this.AuthenticationType : string" Usage="System.Web.ClientServices.ClientFormsIdentity.AuthenticationType" />
<MemberSignature Language="C++ CLI" Value="public:
 property System::String ^ AuthenticationType { System::String ^ get(); };" />
<MemberType>Property</MemberType>
<Implements>
<InterfaceMember>P:System.Security.Principal.IIdentity.AuthenticationType</InterfaceMember>
</Implements>
<AssemblyInfo>
<AssemblyName>System.Web.Extensions</AssemblyName>
<AssemblyVersion>3.5.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-4.0">
<AttributeName Language="C#">[get: System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")]</AttributeName>
<AttributeName Language="F#">[<get: System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")>]</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.String</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets the type of authentication that is used to authenticate the user.</summary>
<value>The type of authentication that is used to authenticate the user.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
You will typically access a <xref:System.Web.ClientServices.ClientFormsIdentity> object as an <xref:System.Security.Principal.IIdentity> reference to avoid a direct dependency on this class. You can determine whether a user is authenticated by checking the <xref:System.Security.Principal.IIdentity.IsAuthenticated%2A?displayProperty=nameWithType> property of the identity. However, the user may be authenticated for Windows, but not for client application services. To determine whether the user is authenticated for client application services, you should also confirm that the <xref:System.Security.Principal.IIdentity.AuthenticationType%2A?displayProperty=nameWithType> property value is "ClientForms". For more information, see the <xref:System.Web.ClientServices.ClientFormsIdentity> class overview.
## Examples
The following example code demonstrates how to use this property through an <xref:System.Security.Principal.IIdentity> reference to determine whether a user is currently authenticated for client application services. This example assumes that the application is in the default configuration where users are not required to log in again when the authentication cookie expires. Otherwise, the <xref:System.Net.WebException> might indicate that the user login has expired.
:::code language="csharp" source="~/snippets/csharp/System.Web.ClientServices/ClientFormsIdentity/Overview/Class1.cs" id="Snippet312":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Winforms/ClientApplicationServices/VB/Class1.vb" id="Snippet312":::
]]></format>
</remarks>
<altmember cref="T:System.Security.Principal.IIdentity" />
<altmember cref="P:System.Security.Principal.IIdentity.IsAuthenticated" />
<altmember cref="P:System.Security.Principal.IIdentity.AuthenticationType" />
<altmember cref="P:System.Web.ClientServices.ClientFormsIdentity.IsAuthenticated" />
<related type="Article" href="https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2010/bb384297(v=vs.100)">Client Application Services</related>
<related type="Article" href="https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2010/bb384312(v=vs.100)">How to: Configure Client Application Services</related>
</Docs>
</Member>
<MemberGroup MemberName="Dispose">
<AssemblyInfo>
<AssemblyName>System.Web.Extensions</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Docs>
<summary>Releases the resources used by the <see cref="T:System.Web.ClientServices.ClientFormsIdentity" />.</summary>
<related type="Article" href="https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2010/bb384297(v=vs.100)">Client Application Services</related>
</Docs>
</MemberGroup>
<Member MemberName="Dispose">
<MemberSignature Language="C#" Value="public void Dispose ();" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig newslot virtual instance void Dispose() cil managed" />
<MemberSignature Language="DocId" Value="M:System.Web.ClientServices.ClientFormsIdentity.Dispose" />
<MemberSignature Language="VB.NET" Value="Public Sub Dispose ()" />
<MemberSignature Language="F#" Value="abstract member Dispose : unit -> unit
override this.Dispose : unit -> unit" Usage="clientFormsIdentity.Dispose " />
<MemberSignature Language="C++ CLI" Value="public:
 virtual void Dispose();" />
<MemberType>Method</MemberType>
<Implements>
<InterfaceMember>M:System.IDisposable.Dispose</InterfaceMember>
</Implements>
<AssemblyInfo>
<AssemblyName>System.Web.Extensions</AssemblyName>
<AssemblyVersion>3.5.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters />
<Docs>
<summary>Releases all resources used by the <see cref="T:System.Web.ClientServices.ClientFormsIdentity" />.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
Call <xref:System.Web.ClientServices.ClientFormsIdentity.Dispose%2A> when you are finished using the <xref:System.Web.ClientServices.ClientFormsIdentity>. The <xref:System.Web.ClientServices.ClientFormsIdentity.Dispose%2A> method leaves the <xref:System.Web.ClientServices.ClientFormsIdentity> in an unusable state. After calling <xref:System.Web.ClientServices.ClientFormsIdentity.Dispose%2A>, you must release all references to the <xref:System.Web.ClientServices.ClientFormsIdentity> so the garbage collector can reclaim the memory that the <xref:System.Web.ClientServices.ClientFormsIdentity> was occupying. For more information, see [Cleaning Up Unmanaged Resources](/dotnet/standard/garbage-collection/unmanaged) and [Implementing a Dispose Method](/dotnet/standard/garbage-collection/implementing-dispose).
> [!NOTE]
> Always call <xref:System.Web.ClientServices.ClientFormsIdentity.Dispose%2A> before you release your last reference to the <xref:System.Web.ClientServices.ClientFormsIdentity>. Otherwise, the resources it is using will not be freed until the garbage collector calls the <xref:System.Web.ClientServices.ClientFormsIdentity> object's `Finalize` method.
]]></format>
</remarks>
<related type="Article" href="https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2010/bb384297(v=vs.100)">Client Application Services</related>
</Docs>
</Member>
<Member MemberName="Dispose">
<MemberSignature Language="C#" Value="protected virtual void Dispose (bool disposing);" />
<MemberSignature Language="ILAsm" Value=".method familyhidebysig newslot virtual instance void Dispose(bool disposing) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Web.ClientServices.ClientFormsIdentity.Dispose(System.Boolean)" />
<MemberSignature Language="VB.NET" Value="Protected Overridable Sub Dispose (disposing As Boolean)" />
<MemberSignature Language="F#" Value="abstract member Dispose : bool -> unit
override this.Dispose : bool -> unit" Usage="clientFormsIdentity.Dispose disposing" />
<MemberSignature Language="C++ CLI" Value="protected:
 virtual void Dispose(bool disposing);" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Web.Extensions</AssemblyName>
<AssemblyVersion>3.5.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="disposing" Type="System.Boolean" />
</Parameters>
<Docs>
<param name="disposing">
<see langword="true" /> to release both managed and unmanaged resources; <see langword="false" /> to release only unmanaged resources.</param>
<summary>Releases the unmanaged resources used by the <see cref="T:System.Web.ClientServices.ClientFormsIdentity" /> and optionally releases the managed resources.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
This method is called by the public `Dispose()` method and the <xref:System.Object.Finalize> method, if it has been overridden. `Dispose()` invokes this method with the `disposing` parameter set to `true`. `Finalize` invokes this method with `disposing` set to `false`.
When the `disposing` parameter is true, this method releases all resources held by any managed objects that this <xref:System.Web.ClientServices.ClientFormsIdentity> references. This method invokes the `Dispose()` method of each referenced object.
]]></format>
</remarks>
<block subset="none" type="overrides">
<para>
<see langword="Dispose" /> can be called multiple times by other objects. When overriding <see langword="Dispose(Boolean)" /> be careful not to reference objects that have been previously disposed of in an earlier call to <see langword="Dispose" />. For more information about how to implement <see langword="Dispose(Boolean)" />, see [Implementing a Dispose Method](/dotnet/standard/garbage-collection/implementing-dispose).
For more information about <see langword="Dispose" /> and <see cref="M:System.Object.Finalize" />, see [Cleaning Up Unmanaged Resources](/dotnet/standard/garbage-collection/unmanaged) and [Overriding the Finalize Method](https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/ddae83kx(v=vs.100)).</para>
</block>
<related type="Article" href="https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2010/bb384297(v=vs.100)">Client Application Services</related>
</Docs>
</Member>
<Member MemberName="IsAuthenticated">
<MemberSignature Language="C#" Value="public bool IsAuthenticated { get; }" />
<MemberSignature Language="ILAsm" Value=".property instance bool IsAuthenticated" />
<MemberSignature Language="DocId" Value="P:System.Web.ClientServices.ClientFormsIdentity.IsAuthenticated" />
<MemberSignature Language="VB.NET" Value="Public ReadOnly Property IsAuthenticated As Boolean" />
<MemberSignature Language="F#" Value="member this.IsAuthenticated : bool" Usage="System.Web.ClientServices.ClientFormsIdentity.IsAuthenticated" />
<MemberSignature Language="C++ CLI" Value="public:
 property bool IsAuthenticated { bool get(); };" />
<MemberType>Property</MemberType>
<Implements>
<InterfaceMember>P:System.Security.Principal.IIdentity.IsAuthenticated</InterfaceMember>
</Implements>
<AssemblyInfo>
<AssemblyName>System.Web.Extensions</AssemblyName>
<AssemblyVersion>3.5.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-4.0">
<AttributeName Language="C#">[get: System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")]</AttributeName>
<AttributeName Language="F#">[<get: System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")>]</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Boolean</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets a value indicating whether the user has been authenticated.</summary>
<value>
<see langword="true" /> if the user has been authenticated; otherwise, <see langword="false" />.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
You will typically access a <xref:System.Web.ClientServices.ClientFormsIdentity> object as an <xref:System.Security.Principal.IIdentity> reference to avoid a direct dependency on this class. You can determine whether a user is authenticated by checking the <xref:System.Security.Principal.IIdentity.IsAuthenticated%2A?displayProperty=nameWithType> property of the identity. However, the user may be authenticated for Windows, but not for client application services. To determine whether the user is authenticated for client application services, you should also confirm that the <xref:System.Security.Principal.IIdentity.AuthenticationType%2A?displayProperty=nameWithType> property value is "ClientForms". For more information, see the <xref:System.Web.ClientServices.ClientFormsIdentity> class overview.
## Examples
The following example code demonstrates how to use this property through an <xref:System.Security.Principal.IIdentity> reference to determine whether a user is currently authenticated for client application services. This example assumes that the application is in the default configuration where users are not required to log in again when the authentication cookie expires. Otherwise, the <xref:System.Net.WebException> might indicate that the user login has expired.
:::code language="csharp" source="~/snippets/csharp/System.Web.ClientServices/ClientFormsIdentity/Overview/Class1.cs" id="Snippet312":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Winforms/ClientApplicationServices/VB/Class1.vb" id="Snippet312":::
]]></format>
</remarks>
<altmember cref="P:System.Threading.Thread.CurrentPrincipal" />
<altmember cref="T:System.Security.Principal.IPrincipal" />
<altmember cref="P:System.Security.Principal.IPrincipal.Identity" />
<altmember cref="T:System.Security.Principal.IIdentity" />
<altmember cref="P:System.Security.Principal.IIdentity.IsAuthenticated" />
<altmember cref="P:System.Security.Principal.IIdentity.AuthenticationType" />
<altmember cref="P:System.Web.ClientServices.ClientFormsIdentity.AuthenticationType" />
<related type="Article" href="https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2010/bb384297(v=vs.100)">Client Application Services</related>
<related type="Article" href="https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2010/bb384312(v=vs.100)">How to: Configure Client Application Services</related>
</Docs>
</Member>
<Member MemberName="Name">
<MemberSignature Language="C#" Value="public string Name { get; }" />
<MemberSignature Language="ILAsm" Value=".property instance string Name" />
<MemberSignature Language="DocId" Value="P:System.Web.ClientServices.ClientFormsIdentity.Name" />
<MemberSignature Language="VB.NET" Value="Public ReadOnly Property Name As String" />
<MemberSignature Language="F#" Value="member this.Name : string" Usage="System.Web.ClientServices.ClientFormsIdentity.Name" />
<MemberSignature Language="C++ CLI" Value="public:
 property System::String ^ Name { System::String ^ get(); };" />
<MemberType>Property</MemberType>
<Implements>
<InterfaceMember>P:System.Security.Principal.IIdentity.Name</InterfaceMember>
</Implements>
<AssemblyInfo>
<AssemblyName>System.Web.Extensions</AssemblyName>
<AssemblyVersion>3.5.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-4.0">
<AttributeName Language="C#">[get: System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")]</AttributeName>
<AttributeName Language="F#">[<get: System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")>]</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.String</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets the name of the user.</summary>
<value>The name of the user.</value>
<remarks>To be added.</remarks>
<related type="Article" href="https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2010/bb384297(v=vs.100)">Client Application Services</related>
</Docs>
</Member>
<Member MemberName="Provider">
<MemberSignature Language="C#" Value="public System.Web.Security.MembershipProvider Provider { get; }" />
<MemberSignature Language="ILAsm" Value=".property instance class System.Web.Security.MembershipProvider Provider" />
<MemberSignature Language="DocId" Value="P:System.Web.ClientServices.ClientFormsIdentity.Provider" />
<MemberSignature Language="VB.NET" Value="Public ReadOnly Property Provider As MembershipProvider" />
<MemberSignature Language="F#" Value="member this.Provider : System.Web.Security.MembershipProvider" Usage="System.Web.ClientServices.ClientFormsIdentity.Provider" />
<MemberSignature Language="C++ CLI" Value="public:
 property System::Web::Security::MembershipProvider ^ Provider { System::Web::Security::MembershipProvider ^ get(); };" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Web.Extensions</AssemblyName>
<AssemblyVersion>3.5.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-4.0">
<AttributeName Language="C#">[get: System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")]</AttributeName>
<AttributeName Language="F#">[<get: System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")>]</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Web.Security.MembershipProvider</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets the membership provider that is used to authenticate the user.</summary>
<value>The membership provider that is used to authenticate the user.</value>
<remarks>To be added.</remarks>
<related type="Article" href="https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2010/bb384297(v=vs.100)">Client Application Services</related>
</Docs>
</Member>
<Member MemberName="RevalidateUser">
<MemberSignature Language="C#" Value="public void RevalidateUser ();" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig instance void RevalidateUser() cil managed" />
<MemberSignature Language="DocId" Value="M:System.Web.ClientServices.ClientFormsIdentity.RevalidateUser" />
<MemberSignature Language="VB.NET" Value="Public Sub RevalidateUser ()" />
<MemberSignature Language="F#" Value="member this.RevalidateUser : unit -> unit" Usage="clientFormsIdentity.RevalidateUser " />
<MemberSignature Language="C++ CLI" Value="public:
 void RevalidateUser();" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Web.Extensions</AssemblyName>
<AssemblyVersion>3.5.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters />
<Docs>
<summary>Silently authenticates the user by using cached credentials.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
When you use forms authentication to validate the current user, the <xref:System.Web.ClientServices.ClientFormsIdentity> class stores the user credentials as long as the application is running. However, the user is only authenticated until the authentication cookie expires. After the cookie expires, the user must be revalidated to access the remote roles or Web settings services. You can use the **Advanced Settings for Services** dialog box to configure your application to automatically revalidate the user. However, if you configure your application to honor the cookie expiration, you can programmatically revalidate the user by calling the <xref:System.Web.ClientServices.ClientFormsIdentity.RevalidateUser%2A> method. This method is also useful when switching from offline mode to online mode, because the application may have been shut down while offline.
> [!NOTE]
> The <xref:System.Web.ClientServices.ClientFormsIdentity.RevalidateUser%2A> method is for convenience only. Because it does not have a return value, it cannot indicate whether revalidation has failed. Revalidation can fail, for example, if the user credentials have changed on the server. In this case, you might want to include code that explicitly validates users after a service call fails. For more information, see the Accessing Web Settings section in [Walkthrough: Using Client Application Services](/dotnet/framework/common-client-technologies/walkthrough-using-client-application-services).
## Examples
The following example code demonstrates how to use this method to silently revalidate a user when the application leaves the offline state. In this example, a <xref:System.Windows.Forms.CheckBox.CheckedChanged> event handler updates the offline status to match the check box value. If the user sets the application to the online state, the event handler attempts to revalidate the user. However, if the authentication server is unavailable, the event handler returns the application to the offline state.
:::code language="csharp" source="~/snippets/csharp/System.Web.ClientServices/ClientFormsIdentity/Overview/Class1.cs" id="Snippet315":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Winforms/ClientApplicationServices/VB/Class1.vb" id="Snippet315":::
]]></format>
</remarks>
<altmember cref="T:System.Web.ClientServices.ConnectivityStatus" />
<altmember cref="P:System.Web.ClientServices.ConnectivityStatus.IsOffline" />
<related type="Article" href="https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2010/bb384297(v=vs.100)">Client Application Services</related>
<related type="Article" href="https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2010/bb384312(v=vs.100)">How to: Configure Client Application Services</related>
<related type="Article" href="/visualstudio/ide/reference/advanced-settings-for-services-dialog-box">Advanced Settings for Services Dialog Box</related>
<related type="Article" href="https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2010/bb546195(v=vs.100)">Walkthrough: Using Client Application Services</related>
</Docs>
</Member>
</Members>
</Type>