Skip to content

Instantly share code, notes, and snippets.

@coreypnorris
Created May 7, 2015 18:31
Show Gist options
  • Select an option

  • Save coreypnorris/d0facd8b5a21caf04376 to your computer and use it in GitHub Desktop.

Select an option

Save coreypnorris/d0facd8b5a21caf04376 to your computer and use it in GitHub Desktop.
Restricting access to controller actions to certain kinds of http requests
namespace OdeToFood.Controllers
{
public class CuisineController : Controller
{
[HttpGet]
public ActionResult Search(string name)
{
var message = Server.HtmlEncode(name);
return Content(message);
}
[HttpPost]
public ActionResult Search()
{
return Content("Search!");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment