开发者

How to avoid default URL encoding in ASP.NET MVC Html Helpers like RouteLink

I want my url like this:

"http://domain.com/tag/高兴"

My route mapping:

routes.MapRoute("Tag", "tag/{name}", new { controller = "Tag", action="Index" });
开发者_运维问答

But Html.RouteLink will encode the parameters as default. If I use Html.RouteLink in my View, the generated html is:

<a href="/tag/%E9%AB%98%E5%85%B4">高兴</a>

Is there any way to avoid this?


Changed my example.

This works in my case

<%= HttpUtility.UrlDecode(Html.RouteLink("Test", new { id = "高兴" }).ToString())%>

Make sure to change from <%: to <%=

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜