Question

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>
Was it helpful?

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.

OTHER TIPS

Does it work OK if you change the date to 2009-10-10? If so, you have a language/locale issue. ASP.NET is sending the date parameter in MM/DD and SQL Server is expecting DD/MM or vice-versa. Check this setting in ASP.NET and for your SQL Server login.

This may not be the best solution in some cases, but this ended up solving my issue:

http://forums.asp.net/t/1398826.aspx/1

I'd originally tried to dig into the Membership Provider stored procs and start moving all of the DateTime's over to DateTime2's, but I'm sure you can imagine the can of worms that opens up. Either way, the DateTime conversion issue is a good one to know about.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top