Export (0) Print
Expand All
1 out of 3 rated this helpful - Rate this topic

Claims-Aware ASP.NET Web Site

Windows Identity Foundation
[Starting with the .NET Framework 4.5, Windows Identity Foundation (WIF) has been fully integrated into the .NET Framework. The version of WIF addressed by this topic, WIF 3.5, is deprecated and should only be used when developing against the .NET Framework 3.5 SP1 or the .NET Framework 4. For more information about WIF in the .NET Framework 4.5, also known as WIF 4.5, see the Windows Identity Foundation documentation in the .NET Framework 4.5 Development Guide.]

In Visual Studio, open the File menu and select New, Web Site. Select Claims-aware ASP.NET Web Site.

If you look at your web.config file, you’ll see a number of differences from the web.config for a typical ASP.NET Web site.

  • The <configSections> element contains a new section reference:

    <section name="microsoft.identityModel" type="Microsoft.IdentityModel.Configuration.MicrosoftIdentityModelSection, Microsoft.IdentityModel, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
    
  • The assemblies element now includes the WIF assembly:

    <add assembly="Microsoft.IdentityModel, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
    
  • The <authentication mode="Windows"> element has been replaced by:

    <authentication mode="Forms">
    <forms loginUrl="Login.aspx"
        protection="All"
        timeout="30"
        name=".ASPXAUTH"
        path="/"
        requireSSL="false"
        slidingExpiration="true"
        defaultUrl="default.aspx"
        cookieless="UseDeviceProfile"
        enableCrossAppRedirects="false" />
    </authentication>
    <!-- Deny Anonymous users. -->
    <authorization>
        <deny users="?"/>
    </authorization>
    
  • The <httpModules> element now contains a reference to the ClaimsPrincipalHttpModule:

    <add name="ClaimsPrincipalHttpModule" type="Microsoft.IdentityModel.Web.ClaimsPrincipalHttpModule, Microsoft.IdentityModel, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
    
  • The ClaimsPrincipalHttpModule is also added to the <system.webServer>/<modules> element:

    <add name="ClaimsPrincipalHttpModule" type="Microsoft.IdentityModel.Web.ClaimsPrincipalHttpModule, Microsoft.IdentityModel, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" preCondition="managedHandler"/>
    

You can use FedUtil to access the current user’s claims through IClaimsPrincipal. For more information, see How to: Build an ASP.NET Relying Party Application.



Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.