Avoiding Default URL Encoding in ASP.NET MVC Html Helpers such as RouteLink

I need my url like this:

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

Route display:

routes.MapRoute("Tag", "tag/{name}", new { controller = "Tag", action="Index" }); 

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

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

Is there any way to avoid this?

+4
source share
1 answer

Changed my example.

This works in my case.

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

Be sure to change the value from <%: to <% =

+2
source

All Articles