Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Display Modes
  #1 (permalink)  
Old December 16th, 2009, 02:37 PM
Authorized User
 
Join Date: Dec 2009
Posts: 12
Thanks: 1
Thanked 0 Times in 0 Posts
Default [Service, HttpPostOnly]

Could I get an explanation as to what this does?

As I understand it's part of ManagedFusion?
  #2 (permalink)  
Old December 16th, 2009, 02:41 PM
nberardi's Avatar
Wrox Author
 
Join Date: Aug 2008
Location: Phoenixville, PA, USA
Posts: 102
Thanks: 1
Thanked 16 Times in 16 Posts
Send a message via AIM to nberardi
Default

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.
__________________
Check out my blog at: http://www.coderjournal.com
  #3 (permalink)  
Old December 16th, 2009, 02:45 PM
Authorized User
 
Join Date: Dec 2009
Posts: 12
Thanks: 1
Thanked 0 Times in 0 Posts
Default

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?
  #4 (permalink)  
Old December 16th, 2009, 02:46 PM
nberardi's Avatar
Wrox Author
 
Join Date: Aug 2008
Location: Phoenixville, PA, USA
Posts: 102
Thanks: 1
Thanked 16 Times in 16 Posts
Send a message via AIM to nberardi
Default

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.
__________________
Check out my blog at: http://www.coderjournal.com
  #5 (permalink)  
Old January 18th, 2010, 12:20 PM
Registered User
 
Join Date: Jan 2010
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default [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.
  #6 (permalink)  
Old January 19th, 2010, 03:38 PM
Authorized User
 
Join Date: Jan 2010
Posts: 12
Thanks: 0
Thanked 1 Time in 1 Post
Default 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.
  #7 (permalink)  
Old January 21st, 2010, 05:01 AM
Registered User
 
Join Date: Jan 2010
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Question 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?
  #8 (permalink)  
Old January 21st, 2010, 09:55 AM
Authorized User
 
Join Date: Jan 2010
Posts: 12
Thanks: 0
Thanked 1 Time in 1 Post
Default 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.
  #9 (permalink)  
Old January 21st, 2010, 10:19 AM
Registered User
 
Join Date: Jan 2010
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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.
  #10 (permalink)  
Old January 21st, 2010, 10:30 AM
nberardi's Avatar
Wrox Author
 
Join Date: Aug 2008
Location: Phoenixville, PA, USA
Posts: 102
Thanks: 1
Thanked 16 Times in 16 Posts
Send a message via AIM to nberardi
Default

The CountryCodes are under App_GlobalResources

http://thebeerhouse.codeplex.com/Sou...w/61392#690743
__________________
Check out my blog at: http://www.coderjournal.com
 


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Impersonate with windows service for Service A/C vinod_yadav1919 C# 0 October 18th, 2008 03:29 PM
Web Service Consuming another web service CraigWhitfield EJB 0 January 10th, 2008 08:38 AM
Web Service ankesh13 ADO.NET 1 March 8th, 2007 11:12 AM
how to Uninstall a service MadJac C# 2005 3 December 6th, 2006 11:48 AM
Service Oriented Web Service aldwinenriquez .NET Web Services 2 September 15th, 2005 04:25 AM



All times are GMT -4. The time now is 01:25 AM.


Powered by vBulletin®
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.