我在一个ASP.NET MVC 5应用程序中有以下的mailto链接:
<a rel="nofollow" href="@(
String.Format("mailto:?subject={0}&body={1}",
"The title", "The description" + "%0D%0A" + "http://theurl.xyz")">
share by email
</a>
这段代码无法通过HTML验证器。我遇到了以下错误:
元素a的属性href中提供的值mailto:?subject=The subject&body=This is the url:%0D%0Ahttp://localhost:8580/home不合法:查询组件中包含空格,请使用%20代替空格。
我尝试使用HttpUtility.UrlEncode
进行编码,但是在打开邮件时,主题和正文中会出现"+"号和其他字符,而我无法解决该问题。
HttpUtility.UrlPathEncode
了吗? - nemesv