0
剝奪我有一個的WebAPI獲取動作的WebAPI查詢字符串從RequestURI
public HttpResponseMessage Get()
{
try
{
var queryValue = Request.RequestUri.ParseQueryString();
if (queryValue.Count == 0)
{
return Request.CreateResponse(HttpStatusCode.BadRequest, "Query String Filters Required");
}
我打電話與此網址
api/funds?FundProductGroupCT=favourite&pagesize=10&startindex=8
RequestUri總是有剝離的查詢字符串。
這是我的Global.asax
GlobalConfiguration.Configuration.Routes.MapHttpRoute(
name: "DefaultApi",
routeTemplate: "api/{controller}/{id}",
defaults: new { id = System.Web.Http.RouteParameter.Optional }
);
System.Web.Http.GlobalConfiguration.Configuration.Routes.MapHttpRoute
("default", routeTemplate: "api/{controller}/{action}/{id}", defaults: new { id = System.Web.Http.RouteParameter.Optional });
爲什麼你不只是使用OData進行查詢? –