-
Notifications
You must be signed in to change notification settings - Fork 1.5k
/
FormsAuthenticationCredentials.xml
204 lines (183 loc) · 14.9 KB
/
FormsAuthenticationCredentials.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
<Type Name="FormsAuthenticationCredentials" FullName="System.Web.Configuration.FormsAuthenticationCredentials">
<TypeSignature Language="C#" Value="public sealed class FormsAuthenticationCredentials : System.Configuration.ConfigurationElement" />
<TypeSignature Language="ILAsm" Value=".class public auto ansi sealed FormsAuthenticationCredentials extends System.Configuration.ConfigurationElement" />
<TypeSignature Language="DocId" Value="T:System.Web.Configuration.FormsAuthenticationCredentials" />
<TypeSignature Language="VB.NET" Value="Public NotInheritable Class FormsAuthenticationCredentials
Inherits ConfigurationElement" />
<TypeSignature Language="F#" Value="type FormsAuthenticationCredentials = class
 inherit ConfigurationElement" />
<TypeSignature Language="C++ CLI" Value="public ref class FormsAuthenticationCredentials sealed : System::Configuration::ConfigurationElement" />
<AssemblyInfo>
<AssemblyName>System.Web</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Base>
<BaseTypeName>System.Configuration.ConfigurationElement</BaseTypeName>
</Base>
<Interfaces />
<Docs>
<summary>Configures user credentials for ASP.NET applications that use form-based authentication.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The <xref:System.Web.Configuration.FormsAuthenticationCredentials> class provides a way to programmatically access and modify the `credentials` element of a `forms` section in the `authentication` section of the configuration file. This type is part of a group that includes the <xref:System.Web.Configuration.FormsAuthenticationConfiguration>, the <xref:System.Web.Configuration.FormsAuthenticationUserCollection>, and the <xref:System.Web.Configuration.FormsAuthenticationUser> types. With the exception of the collection type, all the others directly affect the underlying configuration tags.
> [!NOTE]
> The <xref:System.Web.Configuration.FormsAuthenticationCredentials> can write information into the related section of the configuration file according to the restrictions defined by <xref:System.Configuration.ConfigurationAllowDefinition.MachineToApplication>. Any attempt to write in a configuration file at a level not allowed in the hierarchy will result in an error message generated by the parser. However, you can use this class to read configuration information at any level in the hierarchy. For safety and scalability, it is recommended that you use an external repository, such as a database, to keep the users' credentials.
## Examples
This example demonstrates how to specify values declaratively for several attributes of the `credentials` section, which can also be accessed as members of the <xref:System.Web.Configuration.FormsAuthenticationCredentials> class.
The following configuration file example shows how to specify values declaratively for the `credentials` section.
```
<credentials passwordFormat="SHA1">
<user name="aspnetuser1"
password="5BAA61E4C9B93F3F0682250B6CF8331B7EE68FD8"/>
<user name="aspnetuser2"
password="E38AD214943DAAD1D64C102FAEC29DE4AFE9DA3D"/>
</credentials>
```
This example uses SHA1. Due to collision problems with SHA1, Microsoft recommends SHA256.
> [!NOTE]
> If you use the `credentials` section, be sure to follow the guidelines explained at [ASP.NET Authentication](https://learn.microsoft.com/previous-versions/aspnet/eeyk640h(v=vs.100)). For scalability and better security, it is recommended that you use an external database to store the users' credentials. For more information about building secure ASP.NET applications, see [Securing Your ASP.NET Application](https://learn.microsoft.com/archive/msdn-magazine/2012/january/asp-net-security-securing-your-asp-net-applications) and [Building Secure ASP.NET Applications: Authentication, Authorization, and Secure Communication](https://learn.microsoft.com/previous-versions/msp-n-p/ff649202(v=pandp.10)).
The following code example demonstrates how to use the <xref:System.Web.Configuration.FormsAuthenticationCredentials> class.
:::code language="csharp" source="~/snippets/csharp/VS_Snippets_WebNet/System.Web.Configuration.FormsAuthenticationCredentials/CS/formsauthenticationcredentials.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_WebNet/System.Web.Configuration.FormsAuthenticationCredentials/VB/formsauthenticationcredentials.vb" id="Snippet1":::
]]></format>
</remarks>
<related type="Article" href="https://learn.microsoft.com/previous-versions/aspnet/eeyk640h(v=vs.100)">ASP.NET Authentication</related>
<related type="Article" href="https://learn.microsoft.com/previous-versions/aspnet/da0adyye(v=vs.100)">Forms Authentication Credentials</related>
<related type="Article" href="https://learn.microsoft.com/previous-versions/aspnet/9wff0kyh(v=vs.100)">Forms Authentication Provider</related>
<related type="Article" href="https://learn.microsoft.com/previous-versions/aspnet/eb0zx8fc(v=vs.100)">Forms Authentication Across Applications</related>
</Docs>
<Members>
<Member MemberName=".ctor">
<MemberSignature Language="C#" Value="public FormsAuthenticationCredentials ();" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor() cil managed" />
<MemberSignature Language="DocId" Value="M:System.Web.Configuration.FormsAuthenticationCredentials.#ctor" />
<MemberSignature Language="VB.NET" Value="Public Sub New ()" />
<MemberSignature Language="C++ CLI" Value="public:
 FormsAuthenticationCredentials();" />
<MemberType>Constructor</MemberType>
<AssemblyInfo>
<AssemblyName>System.Web</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-4.0">
<AttributeName Language="C#">[System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")]</AttributeName>
<AttributeName Language="F#">[<System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")>]</AttributeName>
</Attribute>
</Attributes>
<Parameters />
<Docs>
<summary>Initializes a new instance of the <see cref="T:System.Web.Configuration.FormsAuthenticationCredentials" /> class.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Examples
The following code example shows how to create a <xref:System.Web.Configuration.FormsAuthenticationCredentials> object.
:::code language="csharp" source="~/snippets/csharp/VS_Snippets_WebNet/System.Web.Configuration.FormsAuthenticationCredentials/CS/formsauthenticationcredentials.cs" id="Snippet2":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_WebNet/System.Web.Configuration.FormsAuthenticationCredentials/VB/formsauthenticationcredentials.vb" id="Snippet2":::
]]></format>
</remarks>
</Docs>
</Member>
<Member MemberName="PasswordFormat">
<MemberSignature Language="C#" Value="public System.Web.Configuration.FormsAuthPasswordFormat PasswordFormat { get; set; }" />
<MemberSignature Language="ILAsm" Value=".property instance valuetype System.Web.Configuration.FormsAuthPasswordFormat PasswordFormat" />
<MemberSignature Language="DocId" Value="P:System.Web.Configuration.FormsAuthenticationCredentials.PasswordFormat" />
<MemberSignature Language="VB.NET" Value="Public Property PasswordFormat As FormsAuthPasswordFormat" />
<MemberSignature Language="F#" Value="member this.PasswordFormat : System.Web.Configuration.FormsAuthPasswordFormat with get, set" Usage="System.Web.Configuration.FormsAuthenticationCredentials.PasswordFormat" />
<MemberSignature Language="C++ CLI" Value="public:
 property System::Web::Configuration::FormsAuthPasswordFormat PasswordFormat { System::Web::Configuration::FormsAuthPasswordFormat get(); void set(System::Web::Configuration::FormsAuthPasswordFormat value); };" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Web</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute>
<AttributeName Language="C#">[System.Configuration.ConfigurationProperty("passwordFormat", DefaultValue=System.Web.Configuration.FormsAuthPasswordFormat.SHA1)]</AttributeName>
<AttributeName Language="F#">[<System.Configuration.ConfigurationProperty("passwordFormat", DefaultValue=System.Web.Configuration.FormsAuthPasswordFormat.SHA1)>]</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Web.Configuration.FormsAuthPasswordFormat</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets or sets the password format.</summary>
<value>One of the <see cref="T:System.Web.Configuration.FormsAuthPasswordFormat" /> values.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Examples
The following code example shows how to access the <xref:System.Web.Configuration.FormsAuthenticationCredentials.PasswordFormat%2A> property. Refer to the code example in the <xref:System.Web.Configuration.FormsAuthenticationCredentials> class topic to learn how to get the section.
:::code language="csharp" source="~/snippets/csharp/VS_Snippets_WebNet/System.Web.Configuration.FormsAuthenticationCredentials/CS/formsauthenticationcredentials.cs" id="Snippet3":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_WebNet/System.Web.Configuration.FormsAuthenticationCredentials/VB/formsauthenticationcredentials.vb" id="Snippet3":::
]]></format>
</remarks>
<altmember cref="T:System.Web.Configuration.FormsAuthPasswordFormat" />
</Docs>
</Member>
<Member MemberName="Properties">
<MemberSignature Language="C#" Value="protected override System.Configuration.ConfigurationPropertyCollection Properties { get; }" />
<MemberSignature Language="ILAsm" Value=".property instance class System.Configuration.ConfigurationPropertyCollection Properties" />
<MemberSignature Language="DocId" Value="P:System.Web.Configuration.FormsAuthenticationCredentials.Properties" />
<MemberSignature Language="VB.NET" Value="Protected Overrides ReadOnly Property Properties As ConfigurationPropertyCollection" />
<MemberSignature Language="F#" Value="member this.Properties : System.Configuration.ConfigurationPropertyCollection" Usage="System.Web.Configuration.FormsAuthenticationCredentials.Properties" />
<MemberSignature Language="C++ CLI" Value="protected:
 virtual property System::Configuration::ConfigurationPropertyCollection ^ Properties { System::Configuration::ConfigurationPropertyCollection ^ get(); };" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Web</AssemblyName>
<AssemblyVersion>2.0.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.Configuration.ConfigurationPropertyCollection</ReturnType>
</ReturnValue>
<Docs>
<summary>To be added.</summary>
<value>To be added.</value>
<remarks>To be added.</remarks>
</Docs>
</Member>
<Member MemberName="Users">
<MemberSignature Language="C#" Value="public System.Web.Configuration.FormsAuthenticationUserCollection Users { get; }" />
<MemberSignature Language="ILAsm" Value=".property instance class System.Web.Configuration.FormsAuthenticationUserCollection Users" />
<MemberSignature Language="DocId" Value="P:System.Web.Configuration.FormsAuthenticationCredentials.Users" />
<MemberSignature Language="VB.NET" Value="Public ReadOnly Property Users As FormsAuthenticationUserCollection" />
<MemberSignature Language="F#" Value="member this.Users : System.Web.Configuration.FormsAuthenticationUserCollection" Usage="System.Web.Configuration.FormsAuthenticationCredentials.Users" />
<MemberSignature Language="C++ CLI" Value="public:
 property System::Web::Configuration::FormsAuthenticationUserCollection ^ Users { System::Web::Configuration::FormsAuthenticationUserCollection ^ get(); };" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Web</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute>
<AttributeName Language="C#">[System.Configuration.ConfigurationProperty("", IsDefaultCollection=true, Options=System.Configuration.ConfigurationPropertyOptions.IsDefaultCollection)]</AttributeName>
<AttributeName Language="F#">[<System.Configuration.ConfigurationProperty("", IsDefaultCollection=true, Options=System.Configuration.ConfigurationPropertyOptions.IsDefaultCollection)>]</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Web.Configuration.FormsAuthenticationUserCollection</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets the users' names and password credentials.</summary>
<value>A <see cref="T:System.Web.Configuration.FormsAuthenticationUserCollection" /> that contains the users' names and password credentials.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Examples
The following code example shows how to use the <xref:System.Web.Configuration.FormsAuthenticationCredentials.Users%2A> property. Refer to the code example in the <xref:System.Web.Configuration.FormsAuthenticationCredentials> class topic to learn how to get the section.
:::code language="csharp" source="~/snippets/csharp/VS_Snippets_WebNet/System.Web.Configuration.FormsAuthenticationCredentials/CS/formsauthenticationcredentials.cs" id="Snippet4":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_WebNet/System.Web.Configuration.FormsAuthenticationCredentials/VB/formsauthenticationcredentials.vb" id="Snippet4":::
]]></format>
</remarks>
<altmember cref="T:System.Web.Configuration.FormsAuthenticationUserCollection" />
<altmember cref="T:System.Web.Configuration.FormsAuthenticationUser" />
</Docs>
</Member>
</Members>
</Type>