Sdílet prostřednictvím


<customCookieHandler>

Sets the custom cookie handler type. This element may only be present if the mode attribute of the <cookieHandler> element is "Custom". The custom type must be derived from the CookieHandler class.

<configuration>
  <system.identityModel.services>
    <federationConfiguration>
      <cookieHandler>
        <customCookieHandler>

Syntax

<system.identityModel.services>  
  <federationConfiguration>  
    <cookieHandler mode="Custom">  
      <customCookieHandler type="MyNamespace.MyCustomCookieHandler, MyAssembly" >  
      </customCookieHandler>  
    </cookieHandler>  
  </federationConfiguration>  
</system.identityModel.services>  

Attributes and Elements

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

Attributes

Attribute Description
type Specifies a custom type that derives from the CookieHandler class.

Child Elements

None

Parent Elements

Element Description
<cookieHandler> Configures the CookieHandler that the SessionAuthenticationModule uses to read and write cookies.

Remarks

When you specify a custom cookie handler by setting the mode attribute of the <cookieHandler> element to "Custom", you must specify the type of the custom cookie handler by including a <customCookieHandler> child element that references the cookie handler type. This element cannot be specified when the mode attribute is set to "Chunked" or "Default". Custom cookie handlers must derive from the CookieHandler class.

The <customCookieHandler> element is represented by the CustomTypeElement class.

Example

The following example configures the SAM to use a custom cookie handler of type MyNamespace.MyCustomCookieHandler.

<cookieHandler mode="Custom">  
    <customCookieHandler type="MyNamespace.MyCustomCookieHandler, MyAssembly" />  
</cookieHandler>  

See also