Quantcast
Viewing all articles
Browse latest Browse all 2179

Closed Issue: Couldn't update user profile (membershipupdates branch) [132]

Hello! I have got the expirience with code placed in [membershipupdates branch](https://bugnet.codeplex.com/SourceControl/changeset/23aee97fa84a) and faced with problem that I could not to update user profile (in particular - set preferred locale).

There is next error in the log viewer.

```
System.Data.SqlTypes.SqlTypeException: SqlDateTime overflow. Must be between 1/1/1753 12:00:00 AM and 12/31/9999 11:59:59 PM.
at System.Data.SqlClient.TdsParser.TdsExecuteRPC(_SqlRPC[] rpcArray, Int32 timeout, Boolean inSchema, SqlNotificationRequest notificationRequest, TdsParserStateObject stateObj, Boolean isCommandProc, Boolean sync, TaskCompletionSource`1 completion, Int32 startRpc, Int32 startParam)
at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite)
at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean asyncWrite)
at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(TaskCompletionSource`1 completion, String methodName, Boolean sendToPipe, Int32 timeout, Boolean asyncWrite)
at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
at Altairis.Web.Security.SimpleSqlProfileProvider.SetPropertyValues(SettingsContext context, SettingsPropertyValueCollection collection)
at System.Configuration.SettingsBase.SaveCore()
at System.Configuration.SettingsBase.Save()
at System.Web.Profile.ProfileBase.SaveWithAssert()
at System.Web.Profile.ProfileBase.Save()
at BugNET.BLL.WebProfile.Save() in e:\!_DEVELOPMENT\BugNetRus\src\BugNET.BLL\WebProfile.cs:line 226
at BugNET.Account.UserProfile.SaveCustomSettings_Click(Object sender, EventArgs e) in e:\!_DEVELOPMENT\BugNetRus\src\BugNET_WAP\Account\UserProfile.aspx.cs:line 280
```

I discovered the reason of this bug by debuging __Altairis.Web.Security__ assembly and __SimpleSqlProfileProvider__. It send next sql-command to the database

```
IF EXISTS (SELECT * FROM BugNet_UserProfiles WHERE UserName=@UserName) BEGIN

UPDATE BugNet_UserProfiles
SET
LastUpdate=GETDATE(),
PreferredLocale=@Param0,
IssuesPageSize=@Param4,
ReceiveEmailNotifications=@Param5
WHERE UserName=@UserName

END ELSE BEGIN

INSERT INTO BugNet_UserProfiles
(UserName, LastUpdate, PreferredLocale, SelectedIssueColumns, FirstName, LastName, IssuesPageSize, ReceiveEmailNotifications, PasswordVerificationToken, PasswordVerificationTokenExpirationDate, DisplayName)
VALUES (@UserName, GETDATE(), @Param0, @Param1, @Param2, @Param3, @Param4, @Param5, @Param6, @Param7, @Param8)
END
```
And here list of parameters with their values:
```
@UserName = admin
@Param0 = ru-RU
@Param1 =
@Param2 = Admin
@Param3 = Admin
@Param4 = 10
@Param5 = True
@Param6 =
@Param7 = 1/1/0001 12:00:00 AM
@Param8 = Administrator
```

Look at __@Param7__ for new __PasswordVerificationTokenExpirationDate__ field.

Viewing all articles
Browse latest Browse all 2179

Trending Articles