You are previewing ASP.NET MVC 4 Recipes: A Problem-Solution Approach.
O'Reilly logo
ASP.NET MVC 4 Recipes: A Problem-Solution Approach

Book Description

ASP.NET MVC 4 Recipes is a practical guide for developers creating modern web applications, cutting through the complexities of ASP.NET, jQuery, Knockout.js and HTML 5 to provide straightforward solutions to common web development problems using proven methods based on best practices. The problem-solution approach gets you in, out, and back to work quickly while deepening your understanding of the underlying platform and how to develop with it.

Author John Ciliberti guides you through the framework and development tools, presenting typical challenges, along with code solutions and clear, concise explanations, to accelerate application development. Inside you will find recipes dealing with streamlined syntax, full control over HTML, a simple API for creating RESTful web services, writing support for test driven development, and more. Solve problems immediately by pasting in code from the recipes, or put multiple recipe solutions together to overcome challenging development obstacles.

Dive head first into ASP.NET MVC web development with ASP.NET MVC 4 Recipes.

What you'll learn

Inside find recipes that cover:

  • automating testing and deployment of your application using Visual Studio 2012 and Team Foundation Server

  • designing and developing your application for Internet scale

  • deploying to the cloud, working with Big Data and adding resiliency to your application's components

  • migrating a project from ASP.NET web forms to the MVC 4 including recipes for converting DataGrids, Forms, Web Parts, Master Pages and navigation controls

  • Client side data binding and templating techniques using Web API, Knockout.js and jQuery

  • using the Web API to design web services that can be consumed by mobile devices and tablets running Android, iOS, and Windows 8

Who this book is for

This book is a problem-solution guide for web developers looking for a better way to build a modern web application on the Microsoft platform.

There are several types of developers that would find this material useful:

  • veteran ASP.NET Web Forms developers who wish to update their skillset to include ASP.NET MVC

  • Project teams who wish to modernize an existing application to allow it to take advantage of MVC 4, .NET 4.5, and Windows Azure

  • Novice web developers who are looking to expand their skill set by learning the Microsoft web development stack

Table of Contents

  1. Title Page
  2. Dedication
  3. Contents at a Glance
  4. Contents
  5. About the Author
  6. About the Technical Reviewer
  7. Acknowledgments
  8. Introduction
  9. CHAPTER 1: The Need for Modern Web Applications
    1. 1-1. Developing Modern Web Applications on the Microsoft Platform
    2. 1-2. Learning Through Recipes
    3. 1-3. An Outline of This Book
    4. 1-4. Finding the Recipes That You Need
    5. 1-5. The Code Samples
  10. CHAPTER 2: Understanding ASP.NET MVC
    1. 2-1. Understanding the Microsoft Web Development Ecosystem
    2. 2-2. Understanding the Differences Between the Versions of the MVC Framework
    3. 2-3. Understanding the MVC Pattern
    4. 2-4. Understanding the Differences Between MVC, MVVM, and MVP
    5. 2-5. Deciding Between MVC and Web Forms
    6. 2-6. Understanding the ASP.NET MVC Framework Architecture
    7. 2-7. Understanding Models
    8. 2-8. Understanding Controllers and Actions
    9. 2-9. Understanding Page Routing
    10. 2-10. Understanding View Engines
    11. 2-11. Choosing a View Engine
    12. 2-12. Understanding Razor Syntax
    13. 2-13. Installing an Alternative View Engine
  11. CHAPTER 3: Setting Up Your Environment
    1. 3-1. Acquiring the Ideal Developer Hardware
    2. 3-2. Choosing an Operating System for Your Development Machine
    3. 3-3. Choosing Between IIS Express, IIS 8, and the Visual Studio Development Server
    4. 3-4. Filling Your Development Toolbox
    5. 3-5. Installing Hyper-V and Setting Up a Virtual Machine
    6. 3-6. Connecting to a Remote Development Machine Using RDP
    7. 3-7. Installing Visual Studio 2012
    8. 3-8. Installing Visual Studio MVC 4 Add-on for Visual Studio 2010
    9. 3-9. Installing IIS
    10. 3-10. Configure Your MVC Project to Use IIS Rather Than IIS Express
    11. 3-11. Configure an Application Pool to Use an Application Identity
    12. 3-12. Configuring Visual Studio to Automatically Launch As Administrator
    13. 3-13. Setting Up a Shared Instance of LocalDB
  12. CHAPTER 4: Visual Studio 2012 Overview
    1. 4-1. Understanding Visual Studio 2012
    2. 4-2. Changing the Style of the Visual Studio Menu
    3. 4-3. Changing the Visual Studio Color Scheme
    4. 4-4. Installing Visual Studio Documentation for Offline Use
    5. 4-5. Resetting the Default Visual Studio Window Layout
    6. 4-6. Creating a Custom Toolbar
    7. 4-7. Navigating a Large Razor View or HTML File
    8. 4-8. Using the Page Inspector to Troubleshoot CSS Layout Bugs
    9. 4-9. Using the Page Inspector While Debugging
    10. 4-10. Understanding Visual Studio’s Debugging Windows
    11. 4-11. Setting a Conditional Breakpoint
    12. 4-12. Using the Output Window
    13. 4-13. Using the Extension Manager to Find and Install Add-ons for Visual Studio
    14. 4-14. Visual Studio Keyboard Shortcuts
  13. CHAPTER 5: Getting the Most from the Built-in Templates
    1. 5-1. Choosing an ASP.NET MVC 4 Project Template
    2. 5-2. Creating a Simple Web Site Using the ASP.NET MVC 4 Empty Template
    3. 5-3. Creating a Simple Form with Validation Using the ASP.NET MVC 4 Basic Template
    4. 5-4. Creating an Intranet Site That Uses Windows Authentication Using the ASP.NET MVC 4 Intranet Template
    5. 5-5. Configuring Windows Authentication Using the Web.config File
    6. 5-6. Creating an Internet Site That Uses Forms Authentication Using the Internet Application Template
    7. 5-7. Modifying an Internet Site to Use a Custom SQL Server Database
    8. 5-8. Customizing the Registration Page on an Internet Site Created with the ASP.NET MVC 4 Internet Template
  14. CHAPTER 6: Architecting Applications with ASP.NET MVC
    1. 6-1. Understanding the Role of the Architect
    2. 6-2. Understanding the Buy or Build Decision
    3. 6-3. Deciding Between a Public Cloud and a Private Data Center
    4. 6-4. Determining the Size of Your Application’s Local Network
    5. 6-5. Determining Which Operating System to Deploy
    6. 6-6. Documenting Your Architecture
    7. 6-7. Architecting an ASP.NET MVC Application for the Internet
    8. 6-8. Architecting a Large-Scale Internet Application
    9. 6-9. Architecting a Line-of-Business Application with ASP.NET MVC
    10. 6-10. Configuring SQL Server to Use a Custom Port
  15. CHAPTER 7: Solution Design
    1. 7-1. Designing a View That Requires Data from Multiple Models
    2. 7-2. Using Partial Views to Construct a Composite User Interface
    3. 7-3. Creating a Model Using Entity Framework Database First
    4. 7-4. Creating a Model Using Entity Framework Database First with Oracle
    5. 7-5. Creating a Model Using Entity Framework Model First
    6. 7-6. Creating a Model Using Entity Framework Code First
    7. 7-7. Improving Application Startup Performance
    8. 7-8. Encrypting the Connection Strings in Your Web.config File
    9. 7-9. Using Areas to Organize a Large ASP.MVC Project
    10. 7-10. Disabling Automatic Table Creation with the Simple Membership Provider
  16. CHAPTER 8: Asynchronous Programming with ASP.NET MVC
    1. 8-1. Using Async Actions
    2. 8-2. Running Several Asynchronous Calls in Parallel Inside an Action Method
    3. 8-3. Consuming WCF Service from an MVC 4 Project
    4. 8-4. Boosting the Performance of Task-Based Asynchronous Communications Using Caching
    5. 8-5. Using IL Disassembler to See Code Generated by the C# Compiler
    6. 8-6. Understanding Threading in IIS
    7. 8-7. Using Internet Information Services (IIS) Request Monitoring and Tracing
  17. CHAPTER 9: Test-Driven Development with ASP.NET MVC 4
    1. 9-1. Using Testing to Improve the Quality of Your ASP.NET MVC Application
    2. 9-2. Creating Unit Tests for a Controller Action Using MS Test
    3. 9-3. Understanding Test-Driven Development Strategies
    4. 9-4. Defining a Naming Convention for Your Unit Tests
    5. 9-5. Selecting a Unit Test Framework
    6. 9-6. Downloading and Installing NUnit
    7. 9-7. Creating Unit Tests for Controller Actions Using NUnit
    8. 9-8. Mocking a Repository with Moq
  18. CHAPTER 10: Moving From Web Forms to ASP.NET MVC
    1. 10-1. Creating a Simple Data List Using ASP.NET MVC
    2. 10-2. Creating a Multiple Column Data List Using a Custom HTML Helper Extension
    3. 10-3. Creating a Data Grid with Paging, Sorting, and Filtering Support
    4. 10-4. Creating a Data Grid That Allows Inline Editing
    5. 10-5. Creating a Master/Details View in ASP.NET MVC
    6. 10-6. Custom Validators in ASP.NET MVC
    7. 10-7. Moving from Master Pages in ASP.NET Web Forms to Layout Pages in Razor
    8. 10-8. Creating a Multipage Wizard Using ASP.NET MVC
    9. 10-9. Adding MVC to a Web Forms Project
  19. CHAPTER 11: Creating Modern User Experiences Using jQuery, Knockout.js, and Web API
    1. 11-1. Creating an Adaptive Multicolumn Layout Using CSS Media Queries
    2. 11-2. Creating a Data Grid That Can Page and Sort Without Full-Page Postbacks
    3. 11-3. Implementing Two-Way Data Binding Using Web API and Knockout
    4. 11-4. Creating a Custom Route for an API Controller
    5. 11-5. Using Fiddler to Debug a Web API
  20. CHAPTER 12: Mobile, Social, and Cloud Technologies
    1. 12-1. Using Facebook As Your MVC Web Site’s Identity Provider
    2. 12-2. Creating a Facebook Canvas Page Application with ASP.NET MVC
    3. 12-3. Setting Up Your Development for Working with Windows Azure
    4. 12-4. Storing and Retrieving Files on Windows Azure from an ASP.NET MVC 4 Application
    5. 12-5. Using Fiddler 2 to Help Debug Azure Calls to the Storage Emulator
    6. 12-6. Which Is Better: a Mobile Web Application or a Native Device Application?
    7. 12-7. Creating a Mobile Web Application Using jQuery Mobile and ASP.NET MVC 4
    8. 12-8. Testing Your Mobile Web Application
  21. Index