title: What is wrong with my Membership ValidateUser request? (using ClientFormsAuthenticationMembershipProvider)
body: <p>Are there any simple diagnostics I can run to determine why authentication is not working with the ClientFormsAuthenticationMembershipProvider provider?  My problem:</p>
  
  <p>I have a web site (we shall call it the "Authenticator" web site) hosted on Server A that is configured to use the AspNetSqlMembershipProvider provider for both Membership and Role management.  The (what I think is) relevant web.config keys for that web site are these:</p>
  
  <pre><code>    &lt;membership&gt;
          &lt;providers&gt;
              &lt;clear /&gt;
              &lt;add name="AspNetSqlMembershipProvider"
                   type="System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
                   connectionStringName="MMMS35.API"
                   enablePasswordRetrieval="false"
                   enablePasswordReset="true"
                   requiresQuestionAndAnswer="false"
                   applicationName="Moose"
                   requiresUniqueEmail="false"
                   passwordFormat="Hashed"
                   maxInvalidPasswordAttempts="5"
                   minRequiredPasswordLength="7"
                   minRequiredNonalphanumericCharacters="0"
                   passwordAttemptWindow="1"
                   passwordStrengthRegularExpression="" /&gt;
          &lt;/providers&gt;
      &lt;/membership&gt;
      &lt;profile&gt;
          &lt;providers&gt;
              &lt;clear /&gt;
              &lt;add name="AspNetSqlProfileProvider"
                   connectionStringName="MMMS35.API"
                   applicationName="Moose"
                   type="System.Web.Profile.SqlProfileProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/&gt;
          &lt;/providers&gt;
      &lt;/profile&gt;
      &lt;roleManager enabled="true"&gt;
          &lt;providers&gt;
              &lt;clear /&gt;
              &lt;add name="AspNetSqlRoleProvider"
                   connectionStringName="MMMS35.API"
                   applicationName="Moose"
                   type="System.Web.Security.SqlRoleProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/&gt;
          &lt;/providers&gt;
      &lt;/roleManager&gt;
  </code></pre>
  
  <p>I have another web site (called the "Test Client" web site) hosted on Server B on the same network as Server A, but I do have any idea what the network paths, router configuration, etc. are between Servers A &amp; B.  The Test Client has a mock login setup, which uses the ClientFormsAuthenticationMembershipProvider provider to ask the "Authenticator" web site to authenticate the credentials given on the Test Client.  The relevant web.config sections of the Test Client are these:</p>
  
  <pre><code>    &lt;membership defaultProvider="ClientAuthenticationMembershipProvider"&gt;
          &lt;providers&gt;
              &lt;clear/&gt;
              &lt;add name="ClientAuthenticationMembershipProvider"
                   type="System.Web.ClientServices.Providers.ClientFormsAuthenticationMembershipProvider, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
                   serviceUri="http://slmooseapp1/mia/Authentication_JSON_AppService.axd"
                   credentialsProvider=""
                   savePasswordHashLocally="False"/&gt;
          &lt;/providers&gt;
      &lt;/membership&gt;
      &lt;roleManager defaultProvider="ClientRoleProvider" enabled="true"&gt;
          &lt;providers&gt;
              &lt;clear/&gt;
              &lt;add name="ClientRoleProvider"
                   type="System.Web.ClientServices.Providers.ClientRoleProvider, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
                   serviceUri="http://slmooseapp1/mia/Role_JSON_AppService.axd"
                   cacheTimeout="1"/&gt;
          &lt;/providers&gt;
      &lt;/roleManager&gt;
  </code></pre>
  
  <p>When the Test Client executes this line:</p>
  
  <pre><code>DirectCast(Membership.Provider, ClientServices.Providers.ClientFormsAuthenticationMembershipProvider).ValidateUser(UserName.Text, Password.Text)
  </code></pre>
  
  <p>I get an exception:</p>
  
  <pre><code>System.UnauthorizedAccessException: Access to the path 'C:\Documents and Settings\Default User\Application Data\Microsoft Corporation\Internet Information Services\6.0.3790.3959' is denied.
  </code></pre>
  
  <p>However, when I run the Test Client on my development box (not on Server B) with the exact same web.config serviceUri paths (i.e., my client membership provider is pointing to the same Authentication web site on Server A), validating a user and getting the roles for that user works perfectly.</p>
  
  <p>If I open a browser on Server B and request a page from the Authentication web site, the Authentication web app runs fine, so I know that I can make http requests from Server B to Server A successfully.  What is going on with the ClientFormsAuthenticationMembershipProvider that fails when it is trying to make (what I think is) a JSON request from Server B to Server A?</p>
  
  <p><b>EDIT (9/21/2009):</b></p>
  
  <p>I've tried this scenario now with the Authentication web site and the Test Client on the same box (which is not my development machine).  It still fails.  I wrote a raw Http request programmatically and DID get a successful response...</p>
  
  <p>Request:</p>
  
  <pre><code>Content-Type: application/json
  Host: slappdev
  Content-Length: 70
  Expect: 100-continue
  Connection: Keep-Alive
  
  {"userName":"mdh","password":"test123","createPersistentCookie":false}
  </code></pre>
  
  <p>Response:</p>
  
  <pre><code>MicrosoftOfficeWebServer: 5.0_Pub
  Content-Length: 10
  Cache-Control: private, max-age=0
  Content-Type: application/json; charset=utf-8
  Date: Mon, 21 Sep 2009 20:10:13 GMT
  Set-Cookie: AppName=1756811D52C4619AC78...; path=/; HttpOnly
  Server: Microsoft-IIS/6.0
  X-AspNet-Version: 2.0.50727
  X-Powered-By: ASP.NET
  
  {"d":true}
  </code></pre>
  
  <p>So, my guess is that something is wrong while working through the .Net framework calls to get from ValidateUser to the actual HTTP request.  Any ideas?</p>
  
  <p><b>Edit (9/22/2009)</b>:</p>
  
  <p>The exception thrown is the exact same exception thrown as when my test client web page is attempting to access System.Windows.Forms.Application.UserAppDataPath.  Adding a connectionStringName attribute to the membership/providers/add key that points to a valid connection string name in the web.config file on the client web app changes the exception!</p>
  
  <pre><code>System.Data.SqlClient.SqlException: Invalid object name 'ApplicationProperties'. at System.Data.SqlClient.SqlConnection.OnError
  </code></pre>
  
  <p>So, if all the membership functions are using the serviceUri, why is anything being attempted locally on the client?  And, what utility do I need to run to add these new tables / objects into my database to support the client membership provider?</p>