【问题标题】:The username supplied is invalid提供的用户名无效
【发布时间】:2013-06-27 12:25:58
【问题描述】:

我在 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”,那就更清楚了

如果我在 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”,我的网页表_OAuthMembership 保持为空,而当我通过 MVC 会员系统注册时,我的网页表_Membership 保持为空。

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

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

【问题讨论】:

  • 我不明白 i 是拉丁字符。
  • 这就是我问的原因……这不是很奇怪吗? ://
  • 此时我将从头开始您的配置过程。因为在导致此错误的单词中使用i 使零毫无意义。

标签: c# facebook asp.net-mvc-4 asp.net-membership dotnetopenauth


【解决方案1】:

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

应该是这样的:

Latin1_General_CI_AS

【讨论】:

    猜你喜欢
    • 2012-10-02
    • 1970-01-01
    • 2020-09-27
    • 1970-01-01
    • 2020-07-15
    • 1970-01-01
    • 2020-12-27
    • 1970-01-01
    • 2020-10-23
    相关资源
    最近更新 更多