Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
273 lines (245 sloc) 17.7 KB
<Type Name="AuthenticationSection" FullName="System.Web.Configuration.AuthenticationSection">
<TypeSignature Language="C#" Value="public sealed class AuthenticationSection : System.Configuration.ConfigurationSection" />
<TypeSignature Language="ILAsm" Value=".class public auto ansi sealed AuthenticationSection extends System.Configuration.ConfigurationSection" />
<TypeSignature Language="DocId" Value="T:System.Web.Configuration.AuthenticationSection" />
<TypeSignature Language="VB.NET" Value="Public NotInheritable Class AuthenticationSection&#xA;Inherits ConfigurationSection" />
<TypeSignature Language="C++ CLI" Value="public ref class AuthenticationSection sealed : System::Configuration::ConfigurationSection" />
<TypeSignature Language="F#" Value="type AuthenticationSection = class&#xA; inherit ConfigurationSection" />
<AssemblyInfo>
<AssemblyName>System.Web</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Base>
<BaseTypeName>System.Configuration.ConfigurationSection</BaseTypeName>
</Base>
<Interfaces />
<Docs>
<summary>Configures the authentication for a Web application. This class cannot be inherited.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The <xref:System.Web.Configuration.AuthenticationSection> class provides a way to programmatically access and modify the `authentication` section of a configuration file.
> [!NOTE]
> The <xref:System.Web.Configuration.AuthenticationSection> can write information into the related section of the configuration file according to the restrictions defined by the section property <xref:System.Configuration.SectionInformation.AllowDefinition%2A> whose value is <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 section provides two code examples. The first demonstrates how to specify values declaratively for several attributes of the `authentication` section, which can also be accessed as members of the <xref:System.Web.Configuration.AuthenticationSection> class. The second demonstrates how to use the <xref:System.Web.Configuration.AuthenticationSection> class.
The following configuration file example shows how to specify values declaratively for the `authentication` section.
> [!NOTE]
> If you use the `credentials` section, be sure to follow the guidelines explained at [ASP.NET Authentication](https://msdn.microsoft.com/library/fc10b0ef-4ce4-4a7f-9174-886325221ee1(v=vs.100)). For scalability and better security, it is recommended the use of an external database to store the users' credentials. For more information about building secure ASP.NET applications search the Microsoft MSDN Web site (http://msdn.microsoft.com) for "Securing Your ASP.NET Application", and "Building Secure ASP.NET Applications: Authentication, Authorization, and Secure Communication".
```
<authentication mode="Forms">
<forms name="MyAppCookieName" loginUrl="login.aspx">
<credentials passwordFormat="SHA1">
<user name="Kim"
password="07B7F3EE06F278DB966BE960E7CBBD103DF30CA6"/>
<user name="John"
password="BA56E5E0366D003E98EA1C7F04ABF8FCB3753889"/>
</credentials>
</forms>
</authentication>
```
This example uses SHA1. Due to collision problems with SHA1, Microsoft recommends SHA256.
The following code example demonstrates how to use the <xref:System.Web.Configuration.AuthenticationSection> class.
[!code-csharp[System.Web.Configuration.AuthenticationSection#1](~/samples/snippets/csharp/VS_Snippets_WebNet/System.Web.Configuration.AuthenticationSection/CS/authenticationsection.cs#1)]
[!code-vb[System.Web.Configuration.AuthenticationSection#1](~/samples/snippets/visualbasic/VS_Snippets_WebNet/System.Web.Configuration.AuthenticationSection/VB/authenticationsection.vb#1)]
]]></format>
</remarks>
<altmember cref="T:System.Web.Configuration.FormsAuthenticationConfiguration" />
<altmember cref="T:System.Web.Configuration.PassportAuthentication" />
<related type="Article" href="https://msdn.microsoft.com/library/fc10b0ef-4ce4-4a7f-9174-886325221ee1(v=vs.100)">ASP.NET Authentication</related>
</Docs>
<Members>
<Member MemberName=".ctor">
<MemberSignature Language="C#" Value="public AuthenticationSection ();" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor() cil managed" />
<MemberSignature Language="DocId" Value="M:System.Web.Configuration.AuthenticationSection.#ctor" />
<MemberSignature Language="VB.NET" Value="Public Sub New ()" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; AuthenticationSection();" />
<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>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.AuthenticationSection" /> class.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The <xref:System.Web.Configuration.AuthenticationSection.%23ctor%2A> constructor is not intended to be used directly from your code. It is called by the ASP.NET configuration system. You obtain an instance of the <xref:System.Web.Configuration.AuthenticationSection> class by using the <xref:System.Configuration.Configuration.GetSection%2A> method.
## Examples
The following code example shows how to obtain a <xref:System.Web.Configuration.AuthenticationSection> object.
[!code-csharp[System.Web.Configuration.AuthenticationSection#2](~/samples/snippets/csharp/VS_Snippets_WebNet/System.Web.Configuration.AuthenticationSection/CS/authenticationsection.cs#2)]
[!code-vb[System.Web.Configuration.AuthenticationSection#2](~/samples/snippets/visualbasic/VS_Snippets_WebNet/System.Web.Configuration.AuthenticationSection/VB/authenticationsection.vb#2)]
]]></format>
</remarks>
</Docs>
</Member>
<Member MemberName="Forms">
<MemberSignature Language="C#" Value="public System.Web.Configuration.FormsAuthenticationConfiguration Forms { get; }" />
<MemberSignature Language="ILAsm" Value=".property instance class System.Web.Configuration.FormsAuthenticationConfiguration Forms" />
<MemberSignature Language="DocId" Value="P:System.Web.Configuration.AuthenticationSection.Forms" />
<MemberSignature Language="VB.NET" Value="Public ReadOnly Property Forms As FormsAuthenticationConfiguration" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; property System::Web::Configuration::FormsAuthenticationConfiguration ^ Forms { System::Web::Configuration::FormsAuthenticationConfiguration ^ get(); };" />
<MemberSignature Language="F#" Value="member this.Forms : System.Web.Configuration.FormsAuthenticationConfiguration" Usage="System.Web.Configuration.AuthenticationSection.Forms" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Web</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute>
<AttributeName>System.Configuration.ConfigurationProperty("forms")</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Web.Configuration.FormsAuthenticationConfiguration</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets the <see cref="P:System.Web.Configuration.AuthenticationSection.Forms" /> element property.</summary>
<value>A <see cref="P:System.Web.Configuration.AuthenticationSection.Forms" /> element property that contains information used during forms-based authentication.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Examples
The following code example shows how to use the <xref:System.Web.Configuration.AuthenticationSection.Forms%2A> element property.
[!code-csharp[System.Web.Configuration.AuthenticationSection#5](~/samples/snippets/csharp/VS_Snippets_WebNet/System.Web.Configuration.AuthenticationSection/CS/authenticationsection.cs#5)]
[!code-vb[System.Web.Configuration.AuthenticationSection#5](~/samples/snippets/visualbasic/VS_Snippets_WebNet/System.Web.Configuration.AuthenticationSection/VB/authenticationsection.vb#5)]
]]></format>
</remarks>
<altmember cref="P:System.Web.Configuration.AuthenticationSection.Forms" />
</Docs>
</Member>
<Member MemberName="Mode">
<MemberSignature Language="C#" Value="public System.Web.Configuration.AuthenticationMode Mode { get; set; }" />
<MemberSignature Language="ILAsm" Value=".property instance valuetype System.Web.Configuration.AuthenticationMode Mode" />
<MemberSignature Language="DocId" Value="P:System.Web.Configuration.AuthenticationSection.Mode" />
<MemberSignature Language="VB.NET" Value="Public Property Mode As AuthenticationMode" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; property System::Web::Configuration::AuthenticationMode Mode { System::Web::Configuration::AuthenticationMode get(); void set(System::Web::Configuration::AuthenticationMode value); };" />
<MemberSignature Language="F#" Value="member this.Mode : System.Web.Configuration.AuthenticationMode with get, set" Usage="System.Web.Configuration.AuthenticationSection.Mode" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Web</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute>
<AttributeName>System.Configuration.ConfigurationProperty("mode", DefaultValue=Mono.Cecil.CustomAttributeArgument)</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Web.Configuration.AuthenticationMode</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets or sets the authentication modality.</summary>
<value>One of the <see cref="T:System.Web.Configuration.AuthenticationMode" /> values.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Examples
The following code example shows how to use the <xref:System.Web.Configuration.AuthenticationSection.Mode%2A> property.
[!code-csharp[System.Web.Configuration.AuthenticationSection#4](~/samples/snippets/csharp/VS_Snippets_WebNet/System.Web.Configuration.AuthenticationSection/CS/authenticationsection.cs#4)]
[!code-vb[System.Web.Configuration.AuthenticationSection#4](~/samples/snippets/visualbasic/VS_Snippets_WebNet/System.Web.Configuration.AuthenticationSection/VB/authenticationsection.vb#4)]
]]></format>
</remarks>
<altmember cref="T:System.Web.Configuration.AuthenticationMode" />
</Docs>
</Member>
<Member MemberName="Passport">
<MemberSignature Language="C#" Value="public System.Web.Configuration.PassportAuthentication Passport { get; }" />
<MemberSignature Language="ILAsm" Value=".property instance class System.Web.Configuration.PassportAuthentication Passport" />
<MemberSignature Language="DocId" Value="P:System.Web.Configuration.AuthenticationSection.Passport" />
<MemberSignature Language="VB.NET" Value="Public ReadOnly Property Passport As PassportAuthentication" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; property System::Web::Configuration::PassportAuthentication ^ Passport { System::Web::Configuration::PassportAuthentication ^ get(); };" />
<MemberSignature Language="F#" Value="member this.Passport : System.Web.Configuration.PassportAuthentication" Usage="System.Web.Configuration.AuthenticationSection.Passport" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Web</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute>
<AttributeName>System.Configuration.ConfigurationProperty("passport")</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8">
<AttributeName>System.Obsolete("This property is obsolete. The Passport authentication product is no longer supported and has been superseded by Live ID.")</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Web.Configuration.PassportAuthentication</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets the <see cref="P:System.Web.Configuration.AuthenticationSection.Passport" /> element property.</summary>
<value>A <see cref="P:System.Web.Configuration.AuthenticationSection.Passport" /> element property that contains information used during passport-based authentication.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Examples
The following code example shows how to use the <xref:System.Web.Configuration.AuthenticationSection.Passport%2A> element property.
[!code-csharp[System.Web.Configuration.AuthenticationSection#3](~/samples/snippets/csharp/VS_Snippets_WebNet/System.Web.Configuration.AuthenticationSection/CS/authenticationsection.cs#3)]
[!code-vb[System.Web.Configuration.AuthenticationSection#3](~/samples/snippets/visualbasic/VS_Snippets_WebNet/System.Web.Configuration.AuthenticationSection/VB/authenticationsection.vb#3)]
]]></format>
</remarks>
</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.AuthenticationSection.Properties" />
<MemberSignature Language="VB.NET" Value="Protected Overrides ReadOnly Property Properties As ConfigurationPropertyCollection" />
<MemberSignature Language="C++ CLI" Value="protected:&#xA; virtual property System::Configuration::ConfigurationPropertyCollection ^ Properties { System::Configuration::ConfigurationPropertyCollection ^ get(); };" />
<MemberSignature Language="F#" Value="member this.Properties : System.Configuration.ConfigurationPropertyCollection" Usage="System.Web.Configuration.AuthenticationSection.Properties" />
<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>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="Reset">
<MemberSignature Language="C#" Value="protected override void Reset (System.Configuration.ConfigurationElement parentElement);" />
<MemberSignature Language="ILAsm" Value=".method familyhidebysig virtual instance void Reset(class System.Configuration.ConfigurationElement parentElement) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Web.Configuration.AuthenticationSection.Reset(System.Configuration.ConfigurationElement)" />
<MemberSignature Language="VB.NET" Value="Protected Overrides Sub Reset (parentElement As ConfigurationElement)" />
<MemberSignature Language="C++ CLI" Value="protected:&#xA; override void Reset(System::Configuration::ConfigurationElement ^ parentElement);" />
<MemberSignature Language="F#" Value="override this.Reset : System.Configuration.ConfigurationElement -&gt; unit" Usage="authenticationSection.Reset parentElement" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Web</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="parentElement" Type="System.Configuration.ConfigurationElement" />
</Parameters>
<Docs>
<param name="parentElement">To be added.</param>
<summary>To be added.</summary>
<remarks>To be added.</remarks>
</Docs>
</Member>
</Members>
</Type>
You can’t perform that action at this time.