You are previewing ASP.NET MVC 1.0 Quickly.
O'Reilly logo
ASP.NET MVC 1.0 Quickly

Book Description

Design, develop, and test powerful and robust web applications with MVC framework the agile way

  • Rapid guide to building powerful web applications with ASP.NET MVC framework

  • Covers all facets of web application development including requirement analysis, design, building, testing, and deployment

  • Explore the ASP.NET MVC framework with several newly released features including WebForms, Script Combining, jQuery integration, and ASP.Net MVC AJAX helpers

  • Rich with example code, clear explanations, and interesting examples – a truly hands-on book for ASP.NET developers

In Detail

Using WebForms has led to problems for ASP.NET developers, such as low testability and inconsistent code. These problems become increasingly relevant when trying to develop or maintain anything but the simplest web site.

This book takes you through the ASP.NET MVC framework to help you simplify and build web applications quickly. With example applications built on best practices and with clear explanations, you will get started in no time.

The MVC pattern is widely accepted as one of the best approaches for building modern web applications and Microsoft's new ASP.NET MVC Framework offers a fully supported way for developers to implement MVC in ASP.NET.

This book takes you through the essential tasks to create powerful web applications as fast as possible. These essential tasks are explained clearly, with well-structured instructions. The book does not cover every single feature in detail; it provides precise information for you to get started, and takes you through the creation of an example application that covers MVC application design techniques.

In addition to helping you write code, this book covers unit testing, to improve the stability and quality of the application you are building. It provides a quick reference to the MOQ framework to aid in unit testing. With this book, you will soon have the skills that will make you an ASP.NET developer to be reckoned with, and you will be creating applications with a speed that will astonish your colleagues and boss!

Table of Contents

  1. ASP.NET MVC 1.0 Quickly
    1. Table of Contents
    2. ASP.NET MVC 1.0 Quickly
    3. Credits
    4. About the author
    5. About the reviewers
    6. Preface
      1. What this book covers
      2. What you need for this book
      3. Who this book is for
      4. Conventions
      5. Reader feedback
      6. Customer support
        1. Downloading the example code for the book
        2. Errata
        3. Piracy
        4. Questions
    7. 1. ASP.NET MVC
      1. Model-view-controller
        1. Model
        2. View
        3. Controller
      2. The ASP.NET MVC framework
        1. Driving goals of the ASP.NET MVC framework
        2. Comparing ASP.NET MVC and ASP.NET Webforms
        3. Choosing between ASP.NET MVC and ASP.NET Webforms
      3. Summary
    8. 2. Your First ASP.NET MVC Application
      1. Creating a new ASP.NET MVC web application project
      2. What's inside the box?
      3. Strong-typed ViewData
      4. Creating a new view
      5. Unit testing the controller
      6. Summary
    9. 3. Handling Interactions
      1. Creating a form
        1. Creating a form using HTML
        2. Creating a form using HtmlHelper
      2. Handling posts
        1. Request variables
        2. Updating objects from request variables
        3. Action method parameters
      3. Handling file uploads
        1. Creating an upload form
        2. Creating an upload controller action
      4. Using the ModelBinder attribute
        1. Using the default ModelBinder
        2. Creating a custom ModelBinder
      5. Validating data
      6. Summary
    10. 4. Components in the ASP.NET MVC Framework
      1. The ASP.NET MVC request life cycle
        1. The RouteTable is created
        2. The UrlRoutingModule intercepts the request
        3. The routing engine determines the route
        4. The route handler creates the associated IHttpHandler
        5. The IHttpHandler determines the controller
        6. The controller executes
        7. A ViewEngine is created
        8. The view is rendered
      2. Extensibility
        1. Route objects
        2. MvcRouteHandler
        3. ControllerFactory
        4. Controller
        5. ViewEngine
        6. View
      3. The model in depth
        1. Creating a model
        2. Enabling validation on the model
      4. The controller in depth
        1. Creating a controller
        2. Rendering data on the response
        3. Reading data from the request
        4. Action method selection
        5. Handling unknown controller actions
        6. Action method attributes
      5. The view in depth
        1. Location of views
        2. Creating a view
        3. Master pages
        4. View markup
        5. Partial views
      6. Action filters
        1. IAuthorizationFilter
        2. IActionFilter
        3. IResultFilter
        4. IExceptionFilter
      7. Summary
    11. 5. Routing
      1. What is ASP.NET routing?
      2. ASP.NET routing versus URL rewriting
      3. UrlRoutingModule
      4. Route patterns
      5. Defining routes
        1. Parameter constraints
        2. Catch-all routes
        3. Routing namespaces
        4. Combining ASP.NET MVC and ASP.NET in one web application
      6. Creating URLs from routes
      7. Summary
    12. 6. Customizing and Extending the ASP.NET MVC Framework
      1. Creating a control
      2. Creating a filter attribute
      3. Creating a custom ActionResult
      4. Creating a ViewEngine
      5. Summary
    13. 7. Using Existing ASP.NET Features
      1. Session State
        1. Reading and writing session data
        2. Configuring session state
        3. TempData
      2. Membership, authentication, and authorization
        1. Configuring web site security
        2. Implementing user and role based security in a controller
        3. Configurable authentication options
      3. Caching
      4. Globalization
        1. Resources
          1. Using local resources
          2. Using global resources
        2. Setting language and culture preferences
      5. Mixing ASP.NET Webforms and ASP.NET MVC
        1. Plugging ASP.NET MVC into an existing ASP.NET application
        2. Plugging ASP.NET into an existing ASP.NET MVC application
        3. Sharing data between ASP.NET and ASP.NET MVC
      6. Building views at compile time
      7. Summary
    14. 8. AJAX and ASP.NET MVC
      1. Different AJAX frameworks
        1. XMLHttpRequest
        2. JavaScript Object Notation (JSON)
      2. ASP.NET AJAX
        1. ASP.NET MVC AJAX helper
        2. Working with JsonResult
      3. jQuery
        1. jQuery syntax
        2. Using jQuery with ASP.NET MVC
        3. Working with JsonResult
        4. Using jQuery UI
      4. Summary
    15. 9. Testing an Application
      1. Unit testing
        1. Unit testing frameworks
        2. Hello, unit testing!
        3. Generating unit tests
        4. Testing the action method
        5. Mocking frameworks
        6. Testing the Login action method
      2. Mocking ASP.NET components
      3. Testing routes
      4. Testing UpdateModel scenarios
      5. Summary
    16. 10. Hosting and Deployment
      1. Platforms that can be used
      2. Differences between IIS 7.0 integrated and classic mode
      3. Hosting an ASP.NET MVC web application
        1. Creating a wildcard script map in IIS 7.0
        2. Creating a wildcard script map in IIS 6.0
        3. Modifying the route table to use file extensions
      4. Summary
    17. A. Reference Application— CarTrackr
      1. CarTrackr functionality
        1. Home page
        2. Login screen
        3. List of cars
        4. Car details
        5. Refuellings list
      2. Data layer
        1. Linq to SQL model
        2. Repository pattern
      3. Dependency injection
        1. How CarTrackr controllers are built
        2. Using Unity for dependency injection
      4. ASP.NET MVC Membership Starter Kit
      5. Form validation
      6. ASP.NET provider model
      7. Unit testing CarTrackr
        1. Unit tests in CarTrackr
        2. Mock repository
      8. Summary
    18. B. ASP.NET MVC Mock Helpers
      1. RhinoMocks
      2. Moq
      3. TypeMock
    19. C. Useful Links and Open Source Projects Providing Additional Features
      1. Information portals
        1. ASP.NET/MVC
        3. Articles tagged with ASP.NET MVC
      2. Blogs
      3. Open source projects providing additional features for the ASP.NET MVC framework
        1. ASP.NET MVC Design Gallery
        2. MVC Contrib
        3. xVal validation framework
        4. ASP.NET MVC Membership Starter Kit
        5. XForms
        6. jQuery for ASP.NET MVC
        7. Simple ASP.NET MVC controls
      4. Alternative view engines
        1. Spark view engine
        2. NHaml view engine
        3. NVelocity view engine
      5. Example ASP.NET MVC applications
        1. MVC storefront
        2. FlickrExplorer
        3. Yonkly
        4. Kigg
        5. CarTrackr
    20. Index