I have an MVC controller with the following method
[HttpGet]
public ActionResult Image(int image, string message)
{
I want this to be a GET because it's the appropriate verb to use for the method I'm implementing.
I want to supply "Does this work?" as a parameter to the method. Obviously this is not going to work:
http://localhost:55197/Controller/Image/3/Does%20this%20work?
The question mark is considered part of the query string and is removed. I've read this question which suggests encoding the question mark to %3F
, this makes sense to me (after all we encode our spaces). However when I call the method with this query string:
http://localhost:55197/Controller/Image/3/Does%20this%20work%3F
I get
A potentially dangerous Request.Path value was detected from the client (?).
I've read this question which suggests using the [AllowHtml]
attribute, but this can only be used on properties (and is therefore more appropriate to POST requests.
How can I pass strings like:
Does this work?
I think so...
Into this method?