views:

222

answers:

2

I've never had this problem before, I'm at a total loss.

I have a SQL Server 2008 database with ASP.NET Forms Authentication, profiles and roles created and is functional on the development workstation. I can login using the created users without problem.

I back up the database on the development computer and restore it on the production server. I xcopy the DLLs and ASP.NET files to the server. I make the necessary changes in the web.config, changing the SQL connection strings to point to the production server database and upload it.

I've made sure to generate a machine key and it is the same on both the development web.config and the production web.config.

And yet, when I try to login on the production server, the same user that I'm able to login successfully with on the development computer, fails on the production server.

There is other content in the database, the schema generated by FluentNHibernate. This content is able to be queried successfully on both development and production servers.

This is mind boggling, I believe I've verified everything, but obviously it is still not working and I must have missed something. Please, any ideas?

+2  A: 

I ran into a problem with similar symptoms at one point by forgetting to set the applicationName attribute in the web.config under the membership providers element.

  <membership defaultProvider="SqlProvider">
    <providers>
      <clear />
      <add
        name="SqlProvider"
        applicationName="MyApplication"
        ...
        />
    </providers>
  </membership>

Users are associated to a specific application. Since I didn't set the applicationName, it defaulted to the application path (something like "/MyApplication"). When it was moved to production, the path changed (for example to "/WebSiteFolder/SomeSubFolder/MyApplication"), so the application name defaulted to the new production path and an association could not be made to the original user accounts that were set up in development.

Could your issues possibly be the same as mine?

John Allers
I don't understand why that fixed it, as I have other apps that don't have that attribute set, but it did fix it. Many, many thanks.
Todd Brooks
A: 

I have the same issue as the poster however I have the code mentioned inserted already:

<membership>
   <providers>
    <clear/>
    <add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" connectionStringName="ApplicationServices" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" passwordFormat="Hashed" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" passwordStrengthRegularExpression="" applicationName="/"/>
   </providers>
  </membership>
  <profile>
   <providers>
    <clear/>
    <add name="AspNetSqlProfileProvider" type="System.Web.Profile.SqlProfileProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" connectionStringName="ApplicationServices" applicationName="/"/>
   </providers>
  </profile>
  <roleManager enabled="false">
   <providers>
    <clear/>
    <add connectionStringName="ApplicationServices" applicationName="/" name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
    <add applicationName="/" name="AspNetWindowsTokenRoleProvider" type="System.Web.Security.WindowsTokenRoleProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
   </providers>
  </roleManager>

Any one got anyother idea?

Desmond