Url Encoded Asterisk

If I pass the string as a parameter to Url.Encode, .NET decides not to url encode.

So...

Url.Action("A", "C", new { id = "1*1" }

      

... will create url http: // mysite / C / A / 1 * 1

However, when this link is clicked .NET rejects the parameter and throws an exception ...

A potentially dangerous Request.Path value was detected from the client (*).

      

If I change the url (in chrome) to the url-encoded version ...

http://mysite/C/A/1%2A1

      

... if it still throws the same error?

How can I ensure that URLs generated by .NET on one page are resolved on another page?

+3


source to share





All Articles