
Beginning ASP. NET MVC 1. 0
by Simone Chiaretta; Keyvan Nayyeri-
This Item Qualifies for Free Shipping!*
*Excludes marketplace orders.
Rent Book
New Book
We're Sorry
Sold Out
Used Book
We're Sorry
Sold Out
eBook
We're Sorry
Not Available
How Marketplace Works:
- This item is offered by an independent seller and not shipped from our warehouse
- Item details like edition and cover design may differ from our description; see seller's comments before ordering.
- Sellers much confirm and ship within two business days; otherwise, the order will be cancelled and refunded.
- Marketplace purchases cannot be returned to eCampus.com. Contact the seller directly for inquiries; if no response within two days, contact customer service.
- Additional shipping costs apply to Marketplace purchases. Review shipping costs at checkout.
Summary
Table of Contents
Foreword | p. xxvii |
Introduction | p. xxix |
The Model-View-Controller Pattern | p. 1 |
The History of MVC | p. 1 |
The Principles of MVC | p. 2 |
How the MVC Pattern Flows | p. 2 |
The Passive View | p. 4 |
The Presentation Model | p. 5 |
The Model-View-Presenter Pattern | p. 6 |
Advantages of MVC over Traditional Web Development | p. 7 |
Unit Testing | p. 8 |
Test Driven Development | p. 8 |
The Interface First Approach | p. 9 |
Summary | p. 9 |
Exercises | p. 10 |
ASP.NET WebForms vs. ASP.NET MVC | p. 11 |
Overview | p. 12 |
Contrasting ASP.NET WebForms with ASP.NET MVC | p. 12 |
Problems with ASP.NET WebForms | p. 13 |
How ASP.NET MVC Resolves Issues with ASP.NET WebForms | p. 14 |
The Programming Model | p. 15 |
The ASP.NET WebForms Programming Model | p. 15 |
The ASP.NET MVC Programming Model | p. 16 |
The Main Elements of ASP.NET Development | p. 17 |
How ASP.NET, ASP.NET WebForms, and ASP.NET MVC Relate | p. 17 |
The Implementation of the MVC Pattern in ASP.NET MVC | p. 19 |
The Model in ASP.NET MVC | p. 19 |
The Controller in ASP.NET MVC | p. 19 |
The View in ASP.NET MVC | p. 21 |
Routing in ASP.NET MVC | p. 22 |
Summary | p. 23 |
Exercise | p. 23 |
Getting Started with ASP.NET MVC | p. 25 |
Installing ASP.NET MVC | p. 26 |
Creating an ASP.NET MVC Project | p. 27 |
Examining the Solution Structure | p. 28 |
The Controller | p. 29 |
The View | p. 30 |
The Model | p. 30 |
The ASP.NET MVC Application Class | p. 31 |
The Web Configuration File | p. 32 |
The Content Files | p. 32 |
The Script Files | p. 32 |
Test Projects | p. 32 |
An ASP.NET MVC Example | p. 35 |
Summary | p. 42 |
Exercises | p. 43 |
The Model | p. 45 |
What Microsoft Provides for the "M" in MVC | p. 46 |
An Overview of the Model | p. 47 |
Different Options for Building the Model | p. 47 |
LINQ to SQL | p. 48 |
ADO.NET Database Objects | p. 52 |
ADO.NET Entity Framework | p. 55 |
XML | p. 60 |
Important Considerations about Creating Data Models | p. 64 |
Third-Party Components and Tools | p. 64 |
Summary | p. 65 |
Exercise | p. 65 |
The Controller | p. 67 |
What the Controller Does | p. 67 |
Creating a Controller | p. 68 |
Defining an Action | p. 70 |
Attributes That Control Action Definition | p. 70 |
Passing Data to the View | p. 72 |
ViewData | p. 72 |
Retrieving Data from the Request | p. 77 |
Action Parameters | p. 78 |
Binding Data Inside the Action | p. 82 |
Types of Action Results | p. 83 |
ViewResult | p. 83 |
PartialViewResult | p. 84 |
RedirectResult | p. 85 |
RedirectToRouteResult | p. 87 |
JsonResult | p. 89 |
JavaScriptResult | p. 90 |
ContentResult | p. 90 |
FileContentResult | p. 91 |
EmptyResult | p. 91 |
Using the Core ASP.NET Objects | p. 91 |
Summary | p. 92 |
Exercises | p. 92 |
The View | p. 93 |
The Responsibilities of the View | p. 93 |
The Anatomy of a View | p. 93 |
Creating a View with Visual Studio | p. 95 |
Loosely Typed Views | p. 96 |
Strongly Typed Views | p. 98 |
Writing HTML the ASP.NET MVC Way | p. 100 |
Link-Building Helpers | p. 101 |
Form Helpers | p. 104 |
Validation Helpers | p. 118 |
What about the Rest? | p. 120 |
Writing Your Own Helper Methods | p. 121 |
A Shortcut for Creating Views | p. 124 |
Summary | p. 127 |
Exercises | p. 127 |
Routing | p. 129 |
Life before Routing | p. 129 |
Key Concepts | p. 130 |
The Anatomy of a Route | p. 130 |
The URL Property | p. 131 |
The Defaults Property | p. 131 |
The Constraints Property | p. 132 |
The DataTokens Property | p. 136 |
The RouteHandler Property | p. 139 |
How to Register Routes | p. 139 |
Easier Route Management with ASP.NET MVC | p. 141 |
Debugging Routes | p. 142 |
Summary | p. 144 |
Exercises | p. 145 |
Unit Testing Concepts | p. 147 |
What Is Unit Testing? | p. 147 |
The Benefits of Unit Testing | p. 148 |
The Structure of a Unit Test | p. 149 |
The Four Phases of a Test | p. 149 |
Fixtures | p. 149 |
The Order of Execution | p. 150 |
Attributes That Control Testing | p. 150 |
Result Verification | p. 150 |
Code Coverage | p. 152 |
Writing Tests with Visual Studio | p. 152 |
The Visual Studio Testing User Interface | p. 153 |
Writing Your First Test Class | p. 158 |
Testing Classes That Depend on External Components | p. 161 |
Patterns That Make Testing Easier | p. 162 |
Using a Test Double | p. 165 |
Mock Objects | p. 167 |
Summary | p. 170 |
Exercises | p. 170 |
Testing ASP.NET MVC Applications | p. 173 |
Creating a Test Project for ASP.NET MVC | p. 173 |
Testing without Mocking | p. 174 |
Testing Actions That Render Something | p. 175 |
Testing Actions That Redirect to Another Action | p. 179 |
System.Web.Abstractions | p. 183 |
Testing with Mocking | p. 183 |
Testing Routes | p. 186 |
Putting It All Together | p. 187 |
Analyzing a Legacy Application | p. 187 |
Refactoring to Testable | p. 188 |
Testing the Application | p. 191 |
Developing with a TDD Approach | p. 197 |
Requirements | p. 198 |
Testing for Christmas Day | p. 198 |
Testing for Any Other Day | p. 199 |
Testing for New Year's Day | p. 201 |
It's Refactoring Time | p. 202 |
Summary | p. 203 |
Exercises | p. 203 |
Components | p. 205 |
Why Are There No Server Controls? | p. 205 |
Server Controls | p. 206 |
A Simple Form Control | p. 207 |
Components with Rendering Only | p. 208 |
Controls with Databinding | p. 210 |
Using Partial Views | p. 211 |
Writing a Custom HtmlHelper | p. 218 |
Rendering the Result of an Action | p. 222 |
Writing Client-Side Components with JavaScript | p. 223 |
When to Use Which Option | p. 224 |
Summary | p. 224 |
Exercises | p. 225 |
Action Filters | p. 227 |
What Is an Action Filter? | p. 227 |
Types of Filters | p. 228 |
The Core Filters | p. 229 |
The HandleError Filter | p. 229 |
The Authorize Filter | p. 233 |
The ValidateInput Filter | p. 234 |
The ValidateAntiforgeryToken Filter | p. 234 |
The OutputCache Filter | p. 234 |
Building a Custom Action Filter | p. 236 |
The Base Class: ActionFilterAttribute | p. 236 |
Controller-Scoped Filters | p. 241 |
The Filter Execution Order | p. 242 |
Using Action Filters | p. 245 |
Canceling the Execution of an Action | p. 245 |
Adding More Data for the View | p. 249 |
Summary | p. 255 |
Exercises | p. 256 |
AJAX | p. 257 |
What Is AJAX? | p. 258 |
ASP.NET AJAX | p. 259 |
jQuery | p. 261 |
AJAX in ASP.NET MVC | p. 263 |
Adding AJAX References | p. 263 |
Principles of AJAX Development in ASP.NET MVC Applications | p. 266 |
Putting It into Action: Using AJAX in ASP.NET MVC | p. 267 |
Summary | p. 273 |
Exercises | p. 273 |
Deployment | p. 275 |
ASP.NET Deployment Overview | p. 276 |
ASP.NET MVC Hosting Options | p. 276 |
GAC Installation | p. 277 |
Assembly Deployment | p. 277 |
Hosting Prerequisites | p. 278 |
The .NET Security Policy | p. 279 |
The Web Platform Installer | p. 280 |
Publishing Web Applications | p. 284 |
Summary | p. 286 |
Leveraging ASP.NET WebForm Features | p. 287 |
Caching | p. 288 |
Caching in ASP.NET | p. 289 |
Caching in ASP.NET MVC | p. 289 |
Validation | p. 295 |
Validation in ASP.NET MVC | p. 296 |
Validation with Model State | p. 297 |
Master Pages | p. 303 |
Other Features | p. 305 |
Sitemaps | p. 305 |
The Profile System | p. 306 |
Health Monitoring | p. 306 |
Server Controls | p. 306 |
Summary | p. 306 |
Exercises | p. 307 |
Authentication and Authorization | p. 309 |
Principles of Authentication and Authorization | p. 310 |
Authentication and Authorization in ASP.NET | p. 311 |
The Membership Provider | p. 312 |
The Role Provider | p. 312 |
Authentication and Authorization in ASP.NET MVC | p. 313 |
Configuring Your Application to Use Authorization and Authentication | p. 313 |
Custom Membership and Role Providers | p. 318 |
Limiting Access to Resources with the Authorize Action Filter | p. 318 |
Authentication and Authorization in Action in ASP.NET MVC | p. 319 |
Summary | p. 333 |
Exercises | p. 333 |
Extending ASP.NET MVC | p. 335 |
Introduction to Extensibility | p. 335 |
Areas of Extensibility | p. 336 |
Route Handlers | p. 337 |
Writing a Custom Route Handler | p. 337 |
A Generic WebFormRouteHandler | p. 339 |
The Controller Factory | p. 341 |
Anatomy of a Controller Factory | p. 341 |
Using the Ninject Custom Controller Factory | p. 342 |
View Engines | p. 346 |
Writing a Custom View Engine | p. 347 |
Using a Custom View Engine | p. 352 |
Alternative View Engines | p. 352 |
Minor Extensibility Points | p. 371 |
ActionMethodSelectorAttribute | p. 371 |
TempDataProvider | p. 372 |
Custom ActionResult | p. 374 |
Summary | p. 376 |
Exercises | p. 376 |
Migrating from ASP.NET WebForms | p. 379 |
Why Migrate? | p. 380 |
Overview of the Migration Process | p. 381 |
Fundamental Similarities between ASP.NET WebForms and ASP.NET MVC | p. 382 |
Authentication and Authorization Similarities | p. 382 |
Provider Similarities | p. 382 |
HttpModule and HttpHandler | p. 382 |
Fundamental Differences between ASP.NET WebForms and ASP.NET MVC | p. 383 |
The ViewState Difference | p. 383 |
Differences in Using Server Controls | p. 383 |
Code Model Differences | p. 383 |
Event Model Differences | p. 384 |
Differences in Using URLs | p. 384 |
Differences in the Separation of Resources | p. 385 |
Validation Differences | p. 385 |
Differences in Support for AJAX | p. 385 |
Replacing Controls During Migration to ASP.NET MVC | p. 385 |
Migrating a Simple WebForms Application | p. 386 |
Summary | p. 394 |
Exercise | p. 394 |
Case Study 1 | p. 395 |
The WroxBlog Overview | p. 397 |
The WroxBlog Models | p. 397 |
The WroxBlog Database Structure | p. 398 |
The LINQ to SQL Model | p. 399 |
The Services | p. 399 |
The WroxBlog Controllers | p. 407 |
Implementing HomeController | p. 407 |
Implementing PostController | p. 408 |
Implementing CategoryController | p. 409 |
The WroxBlog Views | p. 410 |
The Site Master | p. 410 |
Adding the Categories Control | p. 412 |
Adding the Post Control | p. 413 |
Adding the Posts Control | p. 414 |
Adding the Comment Control | p. 414 |
Adding the Comments Control | p. 415 |
Adding the CommentForm Control | p. 415 |
Creating the Home View | p. 416 |
Adding the About View | p. 417 |
Creating the IndividualPost View | p. 417 |
Creating the CategoryIndex View | p. 418 |
WroxBlog Routing | p. 418 |
Check It Out | p. 420 |
Summary | p. 423 |
Exercises | p. 423 |
Case Study 2 | p. 425 |
User Stories (aka Requirements) | p. 425 |
The WroxGallery External Libraries | p. 426 |
Flickr.NET | p. 426 |
Using the TDD Approach | p. 427 |
Building the WroxGallery Model | p. 428 |
Creating the Data Model | p. 428 |
Implementing the WroxGallery Services | p. 430 |
The WroxGallery Controller | p. 437 |
The Home Controller | p. 437 |
WroxGallery Account Controller | p. 440 |
Building the Admin Controller | p. 443 |
Configuring the IoCC | p. 443 |
Creating the WroxGallery Views | p. 445 |
Creating the Master Pages | p. 446 |
Adding the Content Pages | p. 449 |
Using AJAX and jQuery | p. 450 |
The Lightbox Plug-In | p. 451 |
The Autocomplete Plug-In | p. 451 |
Running More Tests | p. 456 |
The WroxGallery in Action | p. 456 |
Summary | p. 458 |
Exercise | p. 458 |
Resources | p. 459 |
Communities | p. 459 |
Blogs | p. 459 |
Books | p. 460 |
Tools | p. 460 |
Exercise Solutions | p. 461 |
Index | p. 521 |
Table of Contents provided by Ingram. All Rights Reserved. |
An electronic version of this book is available through VitalSource.
This book is viewable on PC, Mac, iPhone, iPad, iPod Touch, and most smartphones.
By purchasing, you will be able to view this book online, as well as download it, for the chosen number of days.
Digital License
You are licensing a digital product for a set duration. Durations are set forth in the product description, with "Lifetime" typically meaning five (5) years of online access and permanent download to a supported device. All licenses are non-transferable.
More details can be found here.
A downloadable version of this book is available through the eCampus Reader or compatible Adobe readers.
Applications are available on iOS, Android, PC, Mac, and Windows Mobile platforms.
Please view the compatibility matrix prior to purchase.