爲什麼此URL在400中解析 - 錯誤請求?URL編碼的冒號解析爲400錯誤請求
http://localhost:2785/api/ticker/Web.App.QuotesReaders/search=se%3Aabb
我的環境是Visual Studio 2010中,MVC 4和所使用的控制器是WebApiController。
%3A是一個URL編碼的冒號。
SOLUTION
這適用於某些原因:
http://localhost:2785/api/ticker?className=Web.App.QuotesReaders&search=se%3Aabb
...這意味着,我不能指定的global.asax.cs這條路線:
/api/ticker/{className}/{search}
...也沒有...
/api/ticker/{className}/search={search}
...但是這...
/api/ticker
你是不是要寫「?search = s3%3Aabb」? – McGarnagle 2012-04-08 20:27:18
Bridget:http://stackoverflow.com/questions/2593156/how-can-i-send-a-get-request-containing-a-colon-to-an-asp-net-mvc2-controller/2593364#2593364 – Cheeso 2012-04-08 20:27:27
@dbaseman不,我並不是故意寫這個。 – 2012-04-08 20:33:05