这里是我如何进行路由设置。如何处理asp.net web api中的查询字符串参数
routes.MapHttpRoute(
name: "Authors",
routeTemplate: "api/authors",
defaults: new { controller = "authors" }
);
控制器的操作方法
// GET /api/authors/
public string GetAuthors(string author_ids)
{
return data;
}
网址http://site.com/api/authors?author_ids=1实际调用控制器动作,但是当我没有通过查询字符串参数,它说没有找到控制器动作匹配。
如何在定义路由时处理可选的查询字符串参数?