【发布时间】:2014-07-26 19:48:59
【问题描述】:
我有一个带有“%”的文本,我想在链接中使用,但我收到一个错误,(错误请求)
示例:
@{
var title = "less than 1% ."; ///this I would like to pass in url
var url = HttpUtility.HtmlEncode(title); //I try it, but not work!
}
<a href="/cidades/cidade/Categoria/@url">go to city</a>
我使用这条路线:
routes.MapRoute(
name: "Categoria",
url: "{controller}/{action}/categoria/{nome}",
defaults: new { controller = "Cidades", action = "Index", id = UrlParameter.Optional }
);
【问题讨论】: