小编Y8s*_*8sy的帖子

使用Asp.Net Identity中的破折号标识电子邮件

我正在使用ASP.NET MVC身份,当我添加一个test-name@testing.com形式的电子邮件时,我收到验证错误消息

用户名test-name@testing.com无效,只能包含字母或数字.

如何更改验证以便允许接收电子邮件?

我的cshtml是:

@using (Html.BeginForm("Login", "Account", new { ReturnUrl = ViewBag.ReturnUrl }, FormMethod.Post, new { role = "form" }))
        {
            @Html.AntiForgeryToken()

            <div class="reg-header">
                <h2>Register</h2>
            </div>
            <fieldset>
                @if (ViewBag.IsRegister)
                {
                    @Html.ValidationSummary(true, "", new { @class = "text-danger" })
                }
                <div class="margin-bottom-20">
                    @Html.LabelFor(m => m.RegisterViewModel.FirstName)<br />
                    <div class="input-group">
                        <span class="input-group-addon"><i class="fa fa-user"></i></span>
                        @Html.TextBoxFor(m => m.RegisterViewModel.FirstName, new { @class = "form-control" })
                    </div>
                    @Html.ValidationMessageFor(m => m.RegisterViewModel.FirstName, "", new { @class = "text-danger" })
                </div>

                <div class="margin-bottom-20">
                    @Html.LabelFor(m => m.RegisterViewModel.LastName)<br />
                    <div …
Run Code Online (Sandbox Code Playgroud)

asp.net validation asp.net-mvc asp.net-identity

17
推荐指数
2
解决办法
3935
查看次数