I have actions that take string id parameters that are based on a username which can include characters that require encoding, for instance "user?1"
If I use ActionLink()
to generate the links, passing the string without encoding, it generates a link like this: http:\\localhost\controller\action\user?1
, and the action gets passed "user" as the id.
If I UrlEncode()
the string before passing it to ActionLink
, then the link generated is: http:\\localhost\controller\action\user%253f1
as ActionLink will then encode the '%' character for you. Besides this looking ugly, it then also generates a HTTP Error 400 - Bad Request when following the link which I've not yet tracked down the cause of.
Is there any way that I can generate the url like: http:\\localhost\controller\action\user%3f1
?