Windows Azure ASP.NET Providers Sample

The Windows Azure ASP.NET Providers sample shows how to use tables and blobs in Windows Azure storage to host Membership records, Profile records, Role records and Session State information with custom ASP.NET Providers.

C# (7.1 MB)
 
 
 
 
 
4.1 Star
(10)
7,036 times
Add to favorites
7/29/2011
E-mail Twitter del.icio.us Digg Facebook

Solution explorer

C#
<?xml version="1.0"?>

<!--
  For more information on how to configure your ASP.NET application, please visit
  http://go.microsoft.com/fwlink/?LinkId=169433
  -->

<configuration>
  <appSettings>
    <add key="DefaultProviderApplicationName" value="AspProvidersDemo"/>
  </appSettings>
  
  <system.diagnostics>
    <trace>
      <listeners>
        <add type="Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorTraceListener, Microsoft.WindowsAzure.Diagnostics, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
          name="AzureDiagnostics">
          <filter type="" />
        </add>
      </listeners>
    </trace>
  </system.diagnostics>
  
  <connectionStrings>
    <add name="ApplicationServices"
         connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\aspnetdb.mdf;User Instance=true"
         providerName="System.Data.SqlClient" />
  </connectionStrings>

  <system.web>
    <compilation debug="true" targetFramework="4.0" />

    <authentication mode="Forms">
      <forms loginUrl="~/Account/Login.aspx" timeout="2880" />
    </authentication>

    <!-- SessionState Provider Configuration -->
    <sessionState mode="Custom"
                  customProvider="TableStorageSessionStateProvider">
      <providers>
        <clear/>
        <add name="TableStorageSessionStateProvider"
             type="Microsoft.Samples.ServiceHosting.AspProviders.TableStorageSessionStateProvider" />
      </providers>
    </sessionState>

    <!-- Membership Provider Configuration -->
    <membership defaultProvider="TableStorageMembershipProvider" userIsOnlineTimeWindow="20">
      <providers>
        <clear/>
        <add name="TableStorageMembershipProvider"
             type="Microsoft.Samples.ServiceHosting.AspProviders.TableStorageMembershipProvider"
             description="Membership provider using table storage"
             applicationName="AspProvidersDemo"
             enablePasswordRetrieval="false"
             enablePasswordReset="true"
             requiresQuestionAndAnswer="false"
             minRequiredPasswordLength="6"
             minRequiredNonalphanumericCharacters="0"
             requiresUniqueEmail="true"
             passwordFormat="Hashed"/>
      </providers>
    </membership>

    <!-- Profile Manager Provider Configuration -->
    <profile enabled="true" defaultProvider="TableStorageProfileProvider" inherits="AspProvidersDemoWebRole.UserProfile">
      <providers>
        <clear/>
        <add name="TableStorageProfileProvider" 
             type="Microsoft.Samples.ServiceHosting.AspProviders.TableStorageProfileProvider" 
             description="Profile provider using structured storage" 
             applicationName="AspProvidersDemo" />
      </providers>
    </profile>

    <!-- RoleManager Provider Configuration -->
    <roleManager enabled="true"
                 defaultProvider="TableStorageRoleProvider"
                 cacheRolesInCookie="true"
                 cookieName=".ASPXROLES"
                 cookieTimeout="30"
                 cookiePath="/"
                 cookieRequireSSL="false"
                 cookieSlidingExpiration="true"
                 cookieProtection="All">
      <providers>
        <clear/>
        <add name="TableStorageRoleProvider"
             type="Microsoft.Samples.ServiceHosting.AspProviders.TableStorageRoleProvider"
             description="Role provider using table storage"
             applicationName="AspProvidersDemo" />
      </providers>
    </roleManager>

  </system.web>

  <system.webServer>
     <modules runAllManagedModulesForAllRequests="true"/>
  </system.webServer>
</configuration>