我正在使用 asp.net mvc 1.0 版,并且我在 url 中的某些参数有问题!
我的网址是这样的(http://localhost:2282/Tags/PostList/c#)
routes.MapRoute(
"TagsRoute",
"Tags/PostList/{tag}",
new { controller="Tags",Action="PostList",tag = "" }
);
实际上,问题是标签参数没有编码,因此忽略了 simbol #!
我正在使用 actionlink,但可能版本 1.0 不是直接编码参数!
<%=Html.ActionLink(itemtags.Tags.TagName,
"PostList","Tags",
new { tag = itemtags.Tags.TagName },
new { style = "color:red;" })%>
使用此操作链接,只有空格正确编码,事实上 asp.net mvc 变为 asp.net%20mvc 并且工作正常!但是 c# 没有编码:(
所以我尝试使用 Server.UrlEncode,实际上它发生了一些事情!!!
事实上 c# 变成了 c%2523 但它又不正确了,因为 # 的十六进制是 %23!
你有什么解决办法吗???路线限制?
谢谢