Language

How Do I: Use HttpVerbs Attributes in an MVC Application?

By Chris Pels|16 minutes|

In this video Chris Pels shows how to use the HttpVerbs attributes to control access to MVC actions. First, a sample application is created with a default controller and view for editing the information. Next, a second Index action is added to the controller which has an HttpPost attribute which restricts it to being called only when an HTTP POST is used. As a follow-up, the AcceptVerbs() attribute is implemented as an alternative syntax for Visual Studio 2008. A use of the HttpVerbs for preventing the security risk associated with using an HTTP GET to perform a delete from a link is then discussed.

DOWNLOADS: Code (C#)|Code (VB)|MP3|MP4|WMV

Author Information

Chris Pels

Chris Pels – Chris has been instrumental in the architecture, development, and implementation of a wide variety of business systems and databases as a technology consultant since 1986. He has extensive experience in business analysis, technical specifications, database design, several programming languages including C# and VB.NET, and statistical analysis. He holds a Ph.D. from The University of Michigan and has been a speaker at Microsoft TechEd, Microsoft DevDays, VSLive, numerous events in New England