Wrox Programmer Forums
|
BOOK: ASP.NET MVC Website Programming Problem Design Solution ISBN: 9780470410950
This is the forum to discuss the Wrox book ASP.NET MVC Website Programming Problem Design Solution by Nicholas Berardi, Al Katawazi, and Marco Bellinaso; ISBN: 9780470410950
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: ASP.NET MVC Website Programming Problem Design Solution ISBN: 9780470410950 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 25th, 2009, 06:44 AM
Authorized User
 
Join Date: Mar 2007
Posts: 52
Thanks: 6
Thanked 2 Times in 2 Posts
Default Action Method to handle POST, ex. ManageUser

There is one version of the ManageUser action with the
"[Authorize(Roles = "Admin")]" attribute on it. In the ManageUser View, there is a <form method="post" action="ManageUser">

The way I understand it, there should be a ManageUser action with an
[AcceptVerbs("POST")] attribute, to handle what is posted by the user, right?

How come it is possible to do it in this way, when other Action methods has an overloaded version to handle POST?

I don't see the difference...
 
Old September 8th, 2009, 03:14 AM
Authorized User
 
Join Date: Mar 2007
Posts: 52
Thanks: 6
Thanked 2 Times in 2 Posts
Default

Does anyone have an answer to this?
 
Old September 14th, 2009, 04:57 PM
Registered User
 
Join Date: Sep 2007
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

A Post [AcceptVerbs] attribute isn't a requirement for an action to fire for a post. You only need a so-called "post overload" if you have two action methods with the same name, one for the get, which serves up a form, and one for the post of the form. A quote from ScotGu's blog:
http://weblogs.asp.net/scottgu/archi...sed.aspx#seven
"By default ASP.NET MVC now looks for an action method that explicitly supports the incoming http verb - and if one is not found will use the action method that doesn't have an explicit verb specified."

There's only one ManageUser action, and it fires for both get and posts.





Similar Threads
Thread Thread Starter Forum Replies Last Post
post method franta1346 Reporting Services 0 July 22nd, 2007 11:08 PM
Post Method Error spitz Classic ASP Databases 2 June 10th, 2005 04:31 AM
using post method urgently skyman763 General .NET 0 February 13th, 2005 10:42 AM
about post and get method csc820203 HTML Code Clinic 1 August 2nd, 2004 01:13 PM
Post Method? zhenwe1 Servlets 0 January 25th, 2004 01:17 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.