I'm trying to pass u url as parameter to a get method. I defined a route that accepts a {*url} parameter so I can send "/" characters without it separating my parameter. As soon as there is a ":" in the url (like in http: or localhost:3857 for example), the method never gets hit.
The Html.ActionLink method escapes it's parameter itself, but it doesn't seem to escape the ':'. I cannot escape it manually because then the escape characters get escaped by the very same Html.Actionlink method.
any ideas?
-
Use EncodeUrl before you pass it, and then decode it on the other side.
borisCallens : I don't know about any EncodeUrl (where can I find it) but I did try HttpUtility.UrlEncode and HttpUtility.UrlPathencode. They both end up routing me to a (non existing) destination file rather then my method :(Kieveli : HtmlTextWriter.EncodeUrlborisCallens : HtmlTextWriter.EncodeUrl Method Performs minimal URL encoding by converting spaces in the specified URL to the string "%20". spaces are not my problemborisCallens : http://msdn.microsoft.com/en-us/library/system.web.ui.htmltextwriter.encodeurl(VS.80).aspx -
It's a bit of a hack, but you could replace the ':' with '%3A' (which is the escaped form), and see what the ActionLink does with it. If it's escaped once more, you'd have to replace the twice-escaped version back to ':' at the server, otherwise just replace '%3A' back to ':'
0 comments:
Post a Comment