Skip to content

Instantly share code, notes, and snippets.

@restlessmedia
Created March 4, 2016 10:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save restlessmedia/b81cb258674142f13889 to your computer and use it in GitHub Desktop.
Save restlessmedia/b81cb258674142f13889 to your computer and use it in GitHub Desktop.
.Net WebApi catch all route
config.Routes.MapHttpRoute(
name: "CatchAll",
routeTemplate: "{*.}",
defaults: new { controller = "Default" }
);
public class DefaultController : ApiController
{
[HttpGet]
public HttpResponseMessage Get()
{
return NotFound("Not a valid endpoint");
}
[HttpPost]
public HttpResponseMessage Post()
{
return NotFound("Not a valid endpoint");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment