0
我WebApi
方法用字符串参数:需要用绳子paremeter上的WebAPI法的行为的解释
public IEnumerable<Foo> Get(string stuff)
{
//do stuff
}
路线:
config.Routes.MapHttpRoute(
name: "DefaultApi",
routeTemplate: "api/{controller}/{stuff}",
defaults: new { stuff= RouteParameter.Optional }
);
如果我打电话这样的方法: http://localhost:13892/api/servce?stuff=https://mysite.com/bla?g=1
- 一切都很好
但是如果我去http://localhost:13892/api/servce/https://mysite.com/bla?g=1
- 收到错误:A potentially dangerous Request.Path value was detected from the client (:).
我知道如何解决这个错误但我想知道为什么它是怎么回事? 为什么在第一种情况下,我没有得到那个错误?