Preface; Audience; Assumptions This Book Makes; Conventions Used in This Book; Using Code Examples; Safari® Books Online; How to Contact Us; Up and Running; Chapter 1: Fundamentals of ASP.NET MVC; 1.1 Microsoft's Web Development Platforms; 1.2 The Model-View-Controller Architecture; 1.3 What's New in ASP.NET MVC 4?; 1.4 Introduction to EBuy; 1.5 Installing ASP.NET MVC; 1.6 Creating an ASP.NET MVC Application; 1.7 Routing; 1.8 Controllers; 1.9 Views; 1.10 Models; 1.11 Putting It All Together; 1.12 Authentication; 1.13 Summary; Chapter 2: ASP.NET MVC for Web Forms Developers; 2.1 It's All Just ASP.NET; 2.2 More Differences than Similarities; 2.3 Authoring ASP.NET MVC Views Using Web Forms Syntax; 2.4 Summary; Chapter 3: Working with Data; 3.1 Building a Form; 3.2 Handling Form Posts; 3.3 Saving Data to a Database; 3.4 Validating Data; 3.5 Summary; Chapter 4: Client-Side Development; 4.1 Working with JavaScript; 4.2 Selectors; 4.3 Responding to Events; 4.4 DOM Manipulation; 4.5 AJAX; 4.6 Client-Side Validation; 4.7 Summary; Going to the Next Level; Chapter 5: Web Application Architecture; 5.1 The Model-View-Controller Pattern; 5.2 Architecting a Web Application; 5.3 Design Principles; 5.4 Don't Repeat Yourself; 5.5 Summary; Chapter 6: Enhancing Your Site with AJAX; 6.1 Partial Rendering; 6.2 JavaScript Rendering; 6.3 Reusing Logic Across AJAX and Non-AJAX Requests; 6.4 Sending Data to the Server; 6.5 Cross-Domain AJAX; 6.6 Summary; Chapter 7: The ASP.NET Web API; 7.1 Building a Data Service; 7.2 Paging and Querying Data; 7.3 Exception Handling; 7.4 Media Formatters; 7.5 Summary; Chapter 8: Advanced Data; 8.1 Data Access Patterns; 8.2 Entity Framework Overview; 8.3 Building a Data Access Layer; 8.4 Sorting, Filtering, and Paging Data; 8.5 Summary; Chapter 9: Security; 9.1 Building Secure Web Applications; 9.2 Securing an Application; 9.3 Guarding Against Attacks; 9.4 Summary; Chapter 10: Mobile Web Development; 10.1 ASP.NET MVC 4 Mobile Features; 10.2 Making Your Application Mobile Friendly; 10.3 Improving Mobile Experience; 10.4 Adaptive Rendering; 10.5 Creating a New Mobile Application from Scratch; 10.6 Summary; Going Above and Beyond; Chapter 11: Parallel, Asynchronous, and Real-Time Data Operations; 11.1 Asynchronous Controllers; 11.2 Real-Time Asynchronous Communication; 11.3 Summary; Chapter 12: Caching; 12.1 Types of Caching; 12.2 Server-Side Caching Techniques; 12.3 Client-Side Caching Techniques; 12.4 Summary; Chapter 13: Client-Side Optimization Techniques; 13.1 Anatomy of a Page; 13.2 Best Practices; 13.3 Measuring Client-Side Performance; 13.4 Putting ASP.NET MVC to Work; 13.5 Summary; Chapter 14: Advanced Routing; 14.1 Wayfinding; 14.2 URLs and SEO; 14.3 Building Routes; 14.4 Route Constraints; 14.5 Attribute-Based Routing; 14.6 Extending Routing; 14.7 Summary; Chapter 15: Reusable UI Components; 15.1 What ASP.NET MVC Offers out of the Box; 15.2 Taking It a Step Further; 15.3 Unit Testing Razor Views; 15.4 Summary; Quality Control; Chapter 16: Logging; 16.1 Error Handling in ASP.NET MVC; 16.2 Logging and Tracing; 16.3 Summary; Chapter 17: Automated Testing; 17.1 The Semantics of Testing; 17.2 Levels of Automated Testing; 17.3 What Is an Automated Test Project?; 17.4 Testing an ASP.NET MVC Application; 17.5 Code Coverage; 17.6 Developing Testable Code; 17.7 Summary; Chapter 18: Build Automation; 18.1 Creating Build Scripts; 18.2 Automating the Build; 18.3 Continuous Integration; 18.4 Summary; Going Live; Chapter 19: Deployment; 19.1 What Needs to Be Deployed; 19.2 Deploying to Internet Information Server; 19.3 Deploying to Windows Azure; 19.4 Summary; Appendixes; ASP.NET MVC and Web Forms Integration; Choosing Between ASP.NET MVC and ASP.NET Web Forms; Transitioning a Web Forms Site to ASP.NET MVC; Integrating Web Forms and ASP.NET MVC Functionality; Summary; Leveraging NuGet as a Platform; Installing the NuGet Command-Line Tool; Creating NuGet Packages; The Anatomy of a NuGet Package; Types of NuGet Packages; Tool Packages; Sharing Your NuGet Packages; Tips, Tricks, and Pitfalls; Summary; Best Practices; Use the NuGet Package Manager to Manage Dependencies; Depend on Abstractions; Avoid the New Keyword; Avoid Referring to HttpContext Directly (Use HttpContextBase); Avoid "Magic Strings"; Prefer Models over ViewData; Do Not Write HTML in "Backend" Code; Do Not Perform Business Logic in Views; Consolidate Commonly Used View Snippets with Helper Methods; Prefer Presentation Models over Direct Usage of Business Objects; Encapsulate if Statements with HTML Helpers in Views; Prefer Explicit View Names; Prefer Parameter Objects over Long Lists of Parameters; Encapsulate Shared/Common Functionality, Logic, and Data with Action Filters or Child Actions (Html.RenderAction); Prefer Grouping Actions into Controllers Based on How They Relate to Business Concepts; Avoid Grouping Actions into Controllers Based on Technical Relation; Prefer Placing Action Filters at the Highest Appropriate Level; Prefer Multiple Views (and/or Partial Views) over Complex If-Then-Else Logic That Shows and Hides Sections; Prefer the Post-Redirect-Get Pattern When Posting Form Data; Prefer Startup Tasks over Logic Placed in Application_Start (Global.asax); Prefer Authorize Attribute over Imperative Security Checks; Prefer Using the Route Attribute over More Generic Global Routes; Consider Using an Antiforgery Token to Avoid CSRF Attacks; Consider Using the AcceptVerbs Attribute to Restrict How Actions May Be Called; Consider Output Caching; Consider Removing Unused View Engines; Consider Custom ActionResults for Unique Scenarios; Consider Asynchronous Controllers for Controller Tasks That Can Happen in Parallel; Cross-Reference: Targeted Topics, Features, and Scenarios; Index; Colophon;