I have WebApi
method with string parameter:
public IEnumerable<Foo> Get(string stuff)
{
//do stuff
}
Route:
config.Routes.MapHttpRoute(
name: "DefaultApi",
routeTemplate: "api/{controller}/{stuff}",
defaults: new { stuff= RouteParameter.Optional }
);
If I am calling the method like that:
http://localhost:13892/api/servce?stuff=https://mysite.com/bla?g=1
- all good
but if I go http://localhost:13892/api/servce/https://mysite.com/bla?g=1
- getting error: A potentially dangerous Request.Path value was detected from the client (:).
I know how to fix that error but I am wondering why it is happening? Why in first case I am do not getting that error?