共用方式為


<add> Element for authenticationModules (Network Settings)

Adds an authentication module to the application.

<add 
   type = "client type", System, Version="version number", Culture="culture", PublicKeyToken="token" 
/>

Attributes and Elements

The following sections describe attributes, child elements, and parent elements.

Attributes

Attribute Description

type

The class name and specifics of the module that implements the authentication.

Child Elements

None.

Parent Elements

Element Description

authenticationModules

Specifies modules used to authenticate network requests.

Remarks

The add element adds an authentication module to the end of the list of registered authentication modules. Authentication modules are called in the order in which they were added to the list.

The value for the type attribute should be a valid DLL name and corresponding class name, separated by a comma.

Configuration Files

This element can be used in the application configuration file or the machine configuration file (Machine.config).

Example

The following code example enables the default authentication modules. You should replace the values for Version and PublicKeyToken with the correct values for the specified module.

<configuration>
  <system.net>
        <authenticationModules>
            <add type="System.Net.DigestClient, System, Version=2.0.3600.0,
                 Culture=neutral, PublicKeyToken=b77a5c561934e089" />
            <add type="System.Net.NegotiateClient, System, Version=2.0.3600.0,
                 Culture=neutral, PublicKeyToken=b77a5c561934e089" />
            <add type="System.Net.KerberosClient, System, Version=2.0.3600.0,
                 Culture=neutral, PublicKeyToken=b77a5c561934e089" />
            <add type="System.Net.NtlmClient, System, Version=2.0.3600.0,
                 Culture=neutral, PublicKeyToken=b77a5c561934e089" />
            <add type="System.Net.BasicClient, System, Version=2.0.3600.0,
                 Culture=neutral, PublicKeyToken=b77a5c561934e089" />
        </authenticationModules>
  </system.net>
</configuration>

See Also

Reference

Network Settings Schema
IAuthenticationModule
AuthenticationManager