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:
Copy Code <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:
Copy Code <add assembly="Microsoft.IdentityModel, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
- The
<authentication mode="Windows">
element has been replaced by:
Copy Code <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:
Copy Code <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:
Copy Code <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.