ASP.NET MVC 4 in Action

ASP.NET MVC 4 in Action

Jeffrey Palermo, Jimmy Bogard, Eric Hexter

Language: English

Pages: 440

ISBN: 1617290416

Format: PDF / Kindle (mobi) / ePub


ASP.NET MVC 4 in Action is a fast-paced tutorial designed to introduce ASP.NET MVC to .NET developers and show how to apply it effectively. All examples in this revised edition are based on ASP.NET MVC 4, so you'll get full coverage of features such as the Razor view engine, Web Matrix helpers, and improved extensibility. You'll see how your ASP.NET applications can benefit from changes in the .NET Framework.

About the Technology

ASP.NET MVC provides the architecture needed to separate an application's logic and its UI. Because each component's role is well defined, MVC applications are easy to test, maintain, and extend. The latest version, ASP.NET MVC 4, takes advantage of .NET 4 and includes powerful features like the Razor view engine, Web Matrix helpers, and enhanced extensibility.

About the Book

ASP.NET MVC 4 in Action is a hands-on guide that shows you how to apply ASP.NET MVC effectively. After a high-speed ramp up, this thoroughly revised new edition explores each key topic with a self-contained example so you can jump right to the parts you need. Based on thousands of hours of real-world experience, the authors show you valuable high-end techniques you won't find anywhere else. Written for developers, the book arms you with the next-level skills and practical guidance to create compelling web applications.

You need some knowledge of ASP.NET and C#, but no prior ASP.NET MVC experience is assumed.

Purchase of the print book comes with an offer of a free PDF, ePub, and Kindle eBook from Manning. Also available is all code from the book.

What's Inside

  • Complete coverage of ASP.NET MVC 4
  • The new Web API
  • Full-system testing

About the Authors

Jeffrey Palermo, Jimmy Bogard, Eric Hexter, Matthew Hinze, and Jeremy Skinner are all ASP.NET MVPs, ASP insiders, and early adopters of ASP.NET MVC.


Table of Contents

  1. Introduction to ASP.NET MVC
  2. Hello MVC world
  3. View fundamentals
  4. Action-packed controllers
  6. View models
  7. Validation
  8. Ajax in ASP.NET MVC
  9. Security
  10. Controlling URLs with routing
  11. Model binders and value providers
  12. Mapping with AutoMapper
  13. Lightweight controllers
  14. Organization with areas
  15. Third-party components
  16. Data access with NHibernate
  18. Extending the controller
  19. Advanced view techniques
  20. Dependency injection and extensibility
  21. Portable areas
  22. Full system testing
  23. Hosting ASP.NET MVC applications
  24. Deployment techniques
  25. Upgrading to ASP.NET MVC 4
  26. ASP.NET Web API

Computer Architecture: A Quantitative Approach (5th Edition)

Introduction to Computer Theory (2nd Edition)

Clustering-Based Support for Software Architecture Restructuring (Software Engineering Research)

Formal Languages and Compilation (2nd Edition) (Texts in Computer Science)

Principles of Artificial Neural Networks (2nd Edition) (Advanced Series in Circuits and Systems, Volume 6)














make use of the GuestbookContext and GuestbookEntry classes that we defined previously. We’ll begin by adding a new overload of the Create action to the GuestbookController. Listing 2.6 Processing the form data using a controller action public class GuestbookController : Controller { private GuestbookContext _db = new GuestbookContext(); public ActionResult Create() { return View(); } B [HttpPost] public ActionResult Create(GuestbookEntry entry) Download from Wow! eBook

the UI layer 322 Installing the testing software 322 Walking through the test manually 323 Automating the test 325 Running the test 327 ■ ■ 20.2 20.3 20.4 20.5 21 ■ Building maintainable navigation Interacting with forms 331 Asserting results 334 Summary 338 327 Hosting ASP.NET MVC applications 339 21.1 21.2 21.3 21.4 21.5 Hosting environments 340 XCOPY deployment 341 IIS 7 345 IIS 6 and 5.1 347 Azure hosting 349 What is Windows Azure, and how do I get it? 350 Configuring the application

explore what happens if you set it to false in section 7.2.4. NOTE As an alternative to setting UnobtrusiveJavaScriptEnabled to true in the web.config, you can also set the static property HtmlHelper.UnobtrusiveJavaScriptEnabled in the Application_Start method of your Global.asax. Depending on whether UnobtrusiveJavaScriptEnabled is set to true or false, ASP.NET MVC’s Ajax helpers will generate markup that is compatible with a particular adapter layer. This adapter layer knows how to take this

RegisterRoutes(RouteCollection routes) { routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); Route routes.MapRoute( name "Default", "{controller}/{action}/{id}", new { controller = "Home", action = "Index", id = UrlParameter.Optional } ); Ignore route URL with parameters Parameter defaults } protected void Application_Start() { RegisterRoutes(RouteTable.Routes); } Register routes at application start Routes are defined by calling the MapRoute method, of which there are several overloads. In

with its built-in REST support, you’ll be disappointed to find that ASP.NET MVC has no built-in support for REST. But due to the extensibility provided by the framework, it’s not difficult to achieve a RESTful architecture. Download from Wow! eBook 162 CHAPTER 9 Controlling URLs with routing Now that you’ve learned what kind of routes you can use, let’s create some with ASP.NET MVC. 9.3 Implementing routes in ASP.NET MVC As you saw in section 9.1, two default routes are

Download sample