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 <%=
精彩评论