1

我在 MVC 成员资格方面遇到了一个问题,这让我很生气。我在我的网站上使用 Facebook 的 OAuth,它工作正常,除非;如果用户名(在这种情况下为姓名和姓氏)包含“i”,我在 mysite/Account/ExternalLoginConfirmation 页面上收到该错误:

Server Error in '/' Application.

The username supplied is invalid.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.Web.Security.MembershipCreateUserException: The username supplied is invalid.

Source Error: 

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

只是为了更清楚,如果用户名是“Meta Brown”,那么如果用户名是“Hail Brown”或类似的东西,我会得到上面的错误。

在 mysite/Account/Register 页面,如果我选择像“hail”这样的用户名,我会收到这个感叹号:

The authentication provider returned an error. Please verify your entry and try again. If the problem persists, please contact your system administrator.

底线当我通过 Facebook 注册时,如果用户名包含字符“i”,我的 pages_OAuthMembership 表保持为空,而当我通过 MVC 会员系统注册时,我的 pages_Membership 表保持为空。

我还为非拉丁字符添加了一个控件:

        [Required]
        [RegularExpression(@"^([a-zA-Z0-9]+)$", ErrorMessage = "Please use Latin characters only.")]
        [Display(Name = "User name")]
        public string UserName { get; set; }
4

1 回答 1

0

您必须将 userprofile 表中的用户名字段更改为拉丁文。它应该可以解决问题。

它应该是这样的:

Latin1_General_CI_AS

于 2013-08-22T14:10:14.250 回答