 |
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
|
|
|
|

December 16th, 2009, 02:37 PM
|
Authorized User
|
|
Join Date: Dec 2009
Posts: 12
Thanks: 1
Thanked 0 Times in 0 Posts
|
|
[Service, HttpPostOnly]
Could I get an explanation as to what this does?
As I understand it's part of ManagedFusion?
|

December 16th, 2009, 02:41 PM
|
 |
Wrox Author
|
|
Join Date: Aug 2008
Posts: 102
Thanks: 1
Thanked 16 Times in 16 Posts
|
|
Service
Responds back with the requested type. If the Accepts header asks for:
application/xml it returns XML from the Model.
same for the JSON header.
HttpPostOnly
Only allows the POST verb to be used against the action method.
|

December 16th, 2009, 02:45 PM
|
Authorized User
|
|
Join Date: Dec 2009
Posts: 12
Thanks: 1
Thanked 0 Times in 0 Posts
|
|
Thanks for the quick response. I don't get it entirely though but maybe that's because it gets explained later in the book? :)
Using this as an example.
[Authorize(Roles = "Admin")]
[Service, HttpPostOnly]
public ActionResult DeleteRole(string id)
{
Roles.DeleteRole(id);
return View(new { id = id });
}
What does it do for this method?
|

December 16th, 2009, 02:46 PM
|
 |
Wrox Author
|
|
Join Date: Aug 2008
Posts: 102
Thanks: 1
Thanked 16 Times in 16 Posts
|
|
It deletes the role and then returns the id of the role that was deleted, so that it can be removed from the HTML page.
|

January 18th, 2010, 12:20 PM
|
Registered User
|
|
Join Date: Jan 2010
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
[Service, HttpPostOnly]
Using the same piece of code I'm getting "Namespace could not be found" I resolved it to System.Web.Services.Description but now get System.Web.Services.Description.Service is not an Attribute Class. What do I need to do to move this on?
TIA.
|

January 19th, 2010, 03:38 PM
|
Authorized User
|
|
Join Date: Jan 2010
Posts: 12
Thanks: 0
Thanked 1 Time in 1 Post
|
|
Include ServiceAttribute
Don't forget to include the ServiceAttribute class. It can be found in the Controllers/ActionFilter folder. It is not documented in the book to do this ( another frustrating thing about this book...). Overall it's a good book, but a lot of explanation was left out. I am glad I knew enough MVC to get through it. I can't imagine being new to this and trying to follow it ;). There are a lot of goodies in it though.
|

January 21st, 2010, 05:01 AM
|
Registered User
|
|
Join Date: Jan 2010
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
ServiceAttribute Class
Many thanks for your reply. I have included the ServiceAttribute class in total and it is now falling over on the ManagedFusion include. The only fererences I can find in the book are in the web.config file to do with email and the fact that Nick Bernadi, co-writer, is the owner of the company. Is this another class or do I need to download the application from SourceForge (on the web) or somewhere else just as suitable?
|

January 21st, 2010, 09:55 AM
|
Authorized User
|
|
Join Date: Jan 2010
Posts: 12
Thanks: 0
Thanked 1 Time in 1 Post
|
|
ManagedFusion
I downloaded the source code from the website and grabbed the dlls from inside the bin folder. I got stuck there too. I don't think the book even mentions that it references those dlls. It is frustrating but if something doesn't work it is probably because you are missing some class from the source code. Not all of the code is documented in the book.
|

January 21st, 2010, 10:19 AM
|
Registered User
|
|
Join Date: Jan 2010
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Iso3166CountryCodes
Ok, I think I'm nearly there, I have one error coming up now and that is
"The name Iso3166CountryCodes does not exist in the current context" I've read in one of your replies that to mention country codes in the book would detract from th book's purpose, however, I have searched for this class and can't seem to find it anywhere, if it is a class that is. Where is the code for this? Many thanks.
|

January 21st, 2010, 10:30 AM
|
 |
Wrox Author
|
|
Join Date: Aug 2008
Posts: 102
Thanks: 1
Thanked 16 Times in 16 Posts
|
|
|
|
 |