Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/asp.net-core/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Asp.net core 如果mvc视图中的验证失败,如何添加链接元素和验证消息_Asp.net Core_Model View Controller - Fatal编程技术网

Asp.net core 如果mvc视图中的验证失败,如何添加链接元素和验证消息

Asp.net core 如果mvc视图中的验证失败,如何添加链接元素和验证消息,asp.net-core,model-view-controller,Asp.net Core,Model View Controller,我有一个要求,如果电子邮件字段验证(如电子邮件)在当时已在使用,则表明验证消息电子邮件已与此验证消息一起发送。我想附加登录链接。我如何才能做到这一点 <div> <input asp-for="Email" type="text" placeholder="Email" class="form-control" /> </div> <span asp-validatio

我有一个要求,如果电子邮件字段验证(如电子邮件)在当时已在使用,则表明验证消息电子邮件已与此验证消息一起发送。我想附加登录链接。我如何才能做到这一点

<div>
  <input asp-for="Email" type="text" placeholder="Email" class="form-control" />
 </div>
<span asp-validation-for="Email" id="err" class="text-danger"></span>

尝试使用远程验证并向登录添加
);
}
返回Json(true);
}
测试屏幕截图:

<a  asp-area="" asp-controller="Account" asp-action="Login" asp-route-aname="indiaRegion">login</a>
Any Help That Grate For Me How Can I append The Link At Time Of email Validation Fail  I have Remote Email Verification For Already In Use 
    [Remote(action: "VerifyEmail", controller: "Home")]
    public string Email { get; set; }
        <div class="form-group">
            <label asp-for="Email" class="control-label"></label>
            <input asp-for="Email" class="form-control" />
            <span asp-validation-for="Email" class="text-danger"></span> 
        </div> 
    [AcceptVerbs("GET", "POST")]
    public IActionResult VerifyEmail(string email)
    { 
        //Generate the login url:
        string loginurl = string.Format("{0}://{1}/{2}", Request.Scheme, Request.Host, "Identity/Account/Login");
        if (_userService.VerifyEmail(email))
        {
            return Json($"Email {email} is already in use, click the <a href='" + loginurl + "'> here </a> to login.");
        }

        return Json(true);
    }