acceptverbs

ASP.NET MVC AcceptVerbs and registering routes

Hi Folks, do I have to register the HttpVerb constraint in my route definition (when i'm registering routes) if i have decorated my action method with the [AcceptVerbs(..)] attribute already? eg. i have this. [AcceptVerbs(HttpVerbs.Post)] public ActionResult Create(FormCollection formCollection) { .. } do i need to add this to the r...

Asp.net MVC AcceptVerbs

Hi folks, Here the RedirectToAction() doesn't call the ActionResult Index. Do I need to register a route for this? [ActionName("onchange")] [AcceptVerbs(HttpVerbs.Post)] public ActionResult OnChange(int i) { m_NumberOfVisibleItems = i; return RedirectToAction("Index"); } ...

Testing MVC Controller Action HttpAcceptAttribute Verbs

What is the best way to unit test the controller action HttpAcceptAttribute verbs? So far I have the following but it's so ugly even a mother couldn't love it and not very flexible. Is there a better way? [Fact] // using xUnit, mocking controller in class public void FilterControllerTestRemoveFilterByProductAttributeIsOfTypePost() { ...

Respond to HTTP HEAD requests using ASP.NET MVC

I'd like to correctly support the HTTP HEAD request when bots hit my ASP.NET MVC site using HEAD. It was brought to my attention that all HTTP HEAD requests to the site were returning 404s, particularly from http://downforeveryoneorjustme.com. Which is really annoying. Wish they would switch to GET like all the other good bots out there....

What is the default behaviour of a controller action not marked with AcceptVerbs, HttpGet or HttpPost?

If I create a controller action and do not decorate it with AcceptVerbs, HttpPost or HttpGet. What is the default behaviour? Does the action allow any access method or does it default to GET? ...