Urls parameters doesn't encoding correctly!

Posted by Ivan90 on Stack Overflow See other posts from Stack Overflow or by Ivan90
Published on 2010-05-13T19:04:03Z Indexed on 2010/05/13 19:14 UTC
Read the original article Hit count: 226

Filed under:
|
|
|
|

I'am using asp.net mvc version 1.0 and I've a problem with some parameter in a url!

My url is look like so(http://localhost:2282/Tags/PostList/c#)

 routes.MapRoute(
           "TagsRoute",
           "Tags/PostList/{tag}",
           new { controller="Tags",Action="PostList",tag = "" }
       );

In effect the problem is that tag paramter isn't encoding and so simbol # is ignored!

I am using an actionlink but maybe with version 1.0 isn't encoding parameter directly!

 <%=Html.ActionLink(itemtags.Tags.TagName,
                               "PostList","Tags",
                            new { tag = itemtags.Tags.TagName }, 
                            new { style = "color:red;" })%>

With this actionlink only whitespace are encoding correctly, infact asp.net mvc become asp.net%20mvc and it work fine! But c# isn't encoding :(

So I try to use Server.UrlEncode, and in effect it happen some stuff!!!

Infact c# became c%2523 but it isn't correct again because hexadecimal of # is %23!

Have you some solutions???? Route Contraints?

Thanks

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about mvc