Forms Authentication works on dev server but not production server (same SQL db)

Posted by Desmond on Stack Overflow See other posts from Stack Overflow or by Desmond
Published on 2010-06-03T07:42:54Z Indexed on 2010/06/03 7:54 UTC
Read the original article Hit count: 496

Filed under:
|
|
|
|

Hi,

I have the same problem as a previously solved question however, this solution did not help me.

I have posted the previous question and answer below:

http://stackoverflow.com/questions/2215963/forms-authentication-works-on-dev-server-but-not-production-server-same-sql-db/2963985#2963985

Question:

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?

Answer:

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.

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?

I have this already in my web.config but still get the issue. Any ideas?

<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 help is greatly appriciated.

© Stack Overflow or respective owner

Related posts about c#

Related posts about authentication