Search code examples
asp.netsql-serverasp.net-membershipsqlmembershipprovider

Migrating asp.net web site breaks Membership Provider


I have a asp.net web site that was developed on the .Net Framework v2 connecting to sql server 2000. I am trying to migrate it to a new server that has the .Net Framework v3.5 on it along with sql server 2008. I backed up the database and restored it to the new database server. I moved the web site and updated the web.config. Now however I cannot login to the website. I ran sql profiler to see what was going on and this is the stored proc that gets run when I attempt to login.

exec dbo.aspnet_Membership_GetPasswordWithFormat @ApplicationName=N'dev',
@UserName=N'AffiliateBob', @UpdateLastLoginActivityDate=1,
@CurrentTimeUtc='2009-10-26 20:43:23.7130000'

Notice the format of the @CurrentTimeUtc parameter. When I put this into sql management studio and run it I get the following error message.

Msg 8114, Level 16, State 1, Procedure aspnet_Membership_GetPasswordWithFormat, Line 0
Error converting data type varchar to datetime.

Here is the membership section from my web.config.

<membership>
    <providers>
        <clear/>
        <add name="AspNetSqlMembershipProvider" 
                    type="System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" 
                    connectionStringName="LocalSqlServer" 
                    enablePasswordRetrieval="false" 
                    enablePasswordReset="true" 
                    requiresQuestionAndAnswer="false" 
                    requiresUniqueEmail="true" 
                    passwordFormat="Hashed" 
                    maxInvalidPasswordAttempts="999" 
                    minRequiredPasswordLength="6" 
                    minRequiredNonalphanumericCharacters="0" 
                    passwordAttemptWindow="999" 
                    passwordStrengthRegularExpression="" 
                    applicationName="dev"/>
    </providers>
</membership>

Solution

  • This turned out to be a web.config issue. That I resolved by creating a new clean web.config file and adding sections from the old web.config.