title: How to use a profile provider in Sitecore?
body: <p>I am looking to create a product catalogue site using Sitecore that will allow users to save products into custom lists they can manage when they use the website.</p>
  
  <p>These lists could potentially contain hundreds of items each so using the standard custom profile attributes could get out of hand so I thought using an external data source would be the best way.</p>
  
  <p>Are there any examples of how to implement a custom profile provider that stores to an external sql database? Is there a better way to do this?</p>
  
  <p><strong>UPDATE</strong>
  To expand on this. To test, I have downloaded the SQL Table Profile Provider example from here: <a href="http://code.msdn.microsoft.com/Using-the-SQL-Table-4c220996" rel="nofollow">http://code.msdn.microsoft.com/Using-the-SQL-Table-4c220996</a>
  and have that running using. I have then added a reference to this provider in the Sitecore project. 
  In the web.config I have: </p>
  
  <pre><code>&lt;profile defaultProvider="switcher" enabled="true" inherits="Sitecore.Security.UserProfile" &gt;
          &lt;providers&gt;
              &lt;clear /&gt;
  
             &lt;add name="sql" type="System.Web.Profile.SqlProfileProvider"  connectionStringName="core" applicationName="sitecore" /&gt;
  
             &lt;add name="TableProfileProvider"
                     type="Microsoft.Samples.SqlTableProfileProvider, SQLTableProfileProviderCS"
                     connectionStringName="myProfileConnString" table="aspnet_Profile2"
                     applicationName="/" /&gt;
  
              &lt;add name="switcher" type="Sitecore.Security.SwitchingProfileProvider, Sitecore.Kernel" applicationName="sitecore" mappings="switchingProviders/profile" /&gt;
          &lt;/providers&gt;
          &lt;properties&gt;
              &lt;clear /&gt;
              &lt;add type="System.String" name="SC_UserData" /&gt;
  
          &lt;/properties&gt;
      &lt;/profile&gt;
  </code></pre>
  
  <p>and under switchingProviders:</p>
  
  <pre><code>        &lt;profile&gt;
              &lt;provider providerName="TableProfileProvider" storeFullNames="false" wildcard="%" domains="mydomain" /&gt;
              &lt;provider providerName="sql" storeFullNames="true" wildcard="%" domains="*" /&gt;
          &lt;/profile&gt;
  </code></pre>
  
  <p>and in /Security/Domains.config:</p>
  
  <pre><code>&lt;domain name="mydomain" ensureAnonymousUser="false"/&gt;
  </code></pre>
  
  <p>If I try to obtain the current users' profile and access the custom attributes using the same method as the SQL Table Profile Provider example project, the custom profile is always null.</p>
  
  <p>I must be missing something in my configuration. 
  Any suggestions would be greatly appreciated. </p>