I want to build a Web API which accepts a string parameter and return a string value,but I always get the error, The requested resource does not support HTTP method GET. I searched a bit in the stack overflow and added the line [AcceptVerbs("GET")] but I still got the error. Could any one help me out?
Global.asax.cs file
config.Routes.MapHttpRoute(
name: "sasRoute",
routeTemplate: "api/sas/{container}",
defaults: new
{
controller = "sas",
container = RouteParameter.Optional
}
);
Controller's method
[Route("{container}")]
[AcceptVerbs("GET")]
[HttpGet]
public string GetContainerToken(string container)
{
return container;
}