Asp.net 如何在模型错误消息中包含mailto链接

Asp.net 如何在模型错误消息中包含mailto链接,asp.net,asp.net-mvc,asp.net-mvc-3,Asp.net,Asp.net Mvc,Asp.net Mvc 3,将mailto添加到此ASP.NET MVC3代码的正确语法是什么。这不起作用,使用双引号也不起作用: ModelState.AddModelError("", "We could not locate the email address you entered. Please check the email address. If you believe it is correct, please contact us by sending an email to <a href='

将mailto添加到此ASP.NET MVC3代码的正确语法是什么。这不起作用,使用双引号也不起作用:

ModelState.AddModelError("", "We could not locate the email address you entered.  Please check the email address.  If you believe it is correct, please contact us by sending an email to <a href='mailto:support@abc.com'>Support</a> from the email address you are attempting to use.");
ModelState.AddModelError(“,”我们找不到您输入的电子邮件地址。请检查电子邮件地址。如果您认为它是正确的,请从您尝试使用的电子邮件地址向发送电子邮件与我们联系。“);

我不太擅长剃须刀,但这可以暂时解决您的问题

@Html.Raw(Html.ValidationSummary().ToString().Replace("[mailto]", "<a href='mailto:support@abc.com'>Support</a>"))
该链接现在从服务器/控制器添加到视图中,用实际链接替换
[mailto]
,并调用
Html.Raw
在浏览器中呈现Html

尝试使用

添加此命名空间:
使用System.Text

    StringBuilder s=new StringBuilder ();
    s.Append(We could not locate the email address you entered.  Please check the email address.  If you believe it is correct, please contact us by sending an email to ");
    s.Append("<a href='mailto:support@abc.com'>Support</a>");
    s.Append("from the email address you are attempting to use.");
    ModelState.AddModelError("", s.ToString());
StringBuilder s=新的StringBuilder();
s、 追加(我们找不到您输入的电子邮件地址。请检查电子邮件地址。如果您认为正确,请通过向发送电子邮件与我们联系”);
s、 附加(“”);
s、 追加(“从您试图使用的电子邮件地址中添加”);
AddModelError(“,s.ToString());

你的意思是“不起作用”?你得到了什么HTML?这是显示在浏览器中的内容:一封电子邮件,这意味着文本正在服务器端进行编码。恐怕除了添加全局JavaScript将其转换为实际链接之外,你没什么可做的。如果可行,请告诉我,我会提供示例。
    StringBuilder s=new StringBuilder ();
    s.Append(We could not locate the email address you entered.  Please check the email address.  If you believe it is correct, please contact us by sending an email to ");
    s.Append("<a href='mailto:support@abc.com'>Support</a>");
    s.Append("from the email address you are attempting to use.");
    ModelState.AddModelError("", s.ToString());