Scott Allen. odetocode.com/blogs/scott/ twitter.com/odetocode

Similar documents
This course provides students with the knowledge and skills to develop ASP.NET MVC 4 web applications.

ASP.NET MVC. in Action JEFFREY PALERMO JIMMY BOGARD BEN SCHEIRMAN MANNING. (74 w. long.) WITH MVCCONTRIB, N HIBERNATE, AND MORE.

Developing ASP.NET MVC 4 Web Applications MOC 20486

Developing ASP.NET MVC 4 Web Applications

Developing ASP.NET MVC 4 Web Applications Course 20486A; 5 Days, Instructor-led

Download this chapter for free at:


Design and Functional Specification

Want to read more? You can buy this book at oreilly.com in print and ebook format. Buy 2 books, get the 3rd FREE!

Programming ASP.NET MVC 4

Sitecore Dashboard User Guide

MVC FRAMEWORK MOCK TEST MVC FRAMEWORK MOCK TEST II

4 Understanding. Web Applications IN THIS CHAPTER. 4.1 Understand Web page development. 4.2 Understand Microsoft ASP.NET Web application development

Drupal CMS for marketing sites

ASP.NET Using C# (VS2012)

Microsoft.Realtests v by.ERICA.50q

Performance Testing for Ajax Applications

How To Train Aspnet

Visual COBOL ASP.NET Shopping Cart Demonstration

MOVING THE SENIOR DEVELOPMENT CLASS FROM WEB DEVELOPMENT TO LIFE CYCLE DEVELOPMENT A CASE FOR VISUAL STUDIO 2005

Nikhil s Web Development Helper

MCTS:.NET Framework 4, Web Applications

Analytics Configuration Reference

Developing Microsoft SharePoint Server 2013 Advanced Solutions. Version: Demo. Page <<1/8>>

Portals and Hosted Files

Cache Configuration Reference

2311A: Advanced Web Application Development using Microsoft ASP.NET Course 2311A Three days Instructor-led

Module 6 Web Page Concept and Design: Getting a Web Page Up and Running

Citrix StoreFront. Customizing the Receiver for Web User Interface Citrix. All rights reserved.

Using Application Insights to Monitor your Applications

An introduction to creating JSF applications in Rational Application Developer Version 8.0

Developers Guide. Designs and Layouts HOW TO IMPLEMENT WEBSITE DESIGNS IN DYNAMICWEB. Version: English

Course Information Course Number: IWT 1229 Course Name: Web Development and Design Foundation

Programming Fundamentals of Web Applications Course 10958A; 5 Days

Notes on how to migrate wikis from SharePoint 2007 to SharePoint 2010

Simply type the id# in the search mechanism of ACS Skills Online to access the learning assets outlined below.

A Model of the Operation of The Model-View- Controller Pattern in a Rails-Based Web Server

HOW TO CREATE THEME IN MAGENTO 2

Developer Tutorial Version 1. 0 February 2015

Exam Ref : Developing ASP.NET MVC 4 Web Applications. William Penberthy

Pentesting Web Frameworks (preview of next year's SEC642 update)

Web Development. Owen Sacco. ICS2205/ICS2230 Web Intelligence

Advanced Web Application Development using Microsoft ASP.NET

NetWrix File Server Change Reporter. Quick Start Guide

Varnish the Drupal way

1 (11) Paperiton DMS Document Management System System Requirements Release: 2012/

How To Create A Website Template On Sitefinity

Microsoft SQL Server Review

Terms and Definitions for CMS Administrators, Architects, and Developers

VB.NET - WEB PROGRAMMING

A Comparative Study of Web Development Technologies Using Open Source and Proprietary Software

Kentico 8 Certified Developer Exam Preparation Guide. Kentico 8 Certified Developer Exam Preparation Guide

Digital Downloads Pro

Introduction to Ingeniux Forms Builder. 90 minute Course CMSFB-V6 P

Certified PHP/MySQL Web Developer Course

Test-Drive ASP.NET MVC

Server-Side Scripting and Web Development. By Susan L. Miertschin

WA2256 Responsive Mobile Web Development with HTML5, CSS3, JavaScript, and jquery Mobile. Classroom Setup Guide. Web Age Solutions Inc.

Outline. Lecture 18: Ruby on Rails MVC. Introduction to Rails

Citrix EdgeSight for NetScaler Rapid Deployment Guide

Tenrox. Single Sign-On (SSO) Setup Guide. January, Tenrox. All rights reserved.

.NET Best Practices Part 1 Master Pages Setup. Version 2.0

Como configurar o IIS Server para ACTi NVR Enterprise

Ajax Development with ASP.NET 2.0

Transition your MCPD Web Developer Skills to MCPD ASP.NET Developer 3.5 (VB)

EVENT VIEWER IN WINDOWS 7

NetWrix SQL Server Change Reporter. Quick Start Guide

DocuSign for SharePoint

Custom Error Pages in ASP.NET Prabhu Sunderaraman

Short notes on webpage programming languages

Tutorial: Building a Dojo Application using IBM Rational Application Developer Loan Payment Calculator

Web-JISIS Reference Manual

Model-View-Controller. and. Struts 2

Feith Rules Engine Version 8.1 Install Guide

Electronic Ticket and Check-in System for Indico Conferences

Advantage of Jquery: T his file is downloaded from

Define and Configure an Application Request Routing Server Farm

TO HACK AN ASP.NET WEBSITE?

Getting Started with AWS. Hosting a Static Website

Framework as a master tool in modern web development

Skills for Employment Investment Project (SEIP)

metaengine DataConnect For SharePoint 2007 Configuration Guide

SEO Optimization A Developer s Role

MVC pattern in java web programming

How Web Browsers Work

SharePoint Apps model overview

ResPAK Internet Module

Templates Improve Application Development

ConvincingMail.com Marketing Solution Manual. Contents

Macromedia Dreamweaver 8 Developer Certification Examination Specification

ultimo theme Update Guide Copyright Infortis All rights reserved

Working with Indicee Elements

This class is intended for experienced software developers who understand object-oriented programming (OOP) and C# or VB.NET.

Adding ELMAH to an ASP.NET Web Application

Tutorial #1: Getting Started with ASP.NET

ASP.NET 5 SOMEONE MOVED YOUR CHEESE. J. Tower

ArcGIS Server mashups

Transcription:

Scott Allen odetocode.com/blogs/scott/ twitter.com/odetocode

Background - 1999 http + + =

Active Server Pages

ASP.NET

The Web 1999-2009 Web standards evolve and strengthen AJAX CSS JavaScript HTML XHTML

Unsolved Mysteries =>

Viewstate

Client HTML

Competition Convention over configuration Separation of concerns Clean URLs and markup

ASP.NET MVC Design Goals Does not replace web forms An alternative project type Still runs on ASP.NET!!! Caching, modules, master pages, providers, handlers, session state Embrace the web No illusions of state no page lifecycle Clean URLs and clean HTML Extensible Testable Pluggable view engines Controller factories Maintains a strict separation of concerns

MVC The Pattern Controller Model View

MVC Routing System.Web.Routing Part of ASP.NET and released with.net 3.5 SP1 Directs incoming request to an MVC controller Define routes during application startup Map URLs to controller action with parameters routes.maproute( "Default", "{controller}/{action}/{id}", new { controller = "Home", action = "Index", id = "" } // Parameter defaults // Route name // URL with parameters

MVC Controllers Public methods are actions Method invoked by ASP.NET once it determines the proper route Controller can build the model and place in ViewData Return value of ActionResult tells the framework where to go next public class HomeController : Controller { public ActionResult Index() { ViewData["Title"] = "Home Page"; ViewData["Message"] = "Welcome to ASP.NET MVC!"; } return View("Home");

Controller & View Conventions Controllers folder Recommended location for controllers. Controller type name must end with Controller (thus omitted from the route). Views folder Recommended location for views.aspx,.ascx,.master files Subfolders for every controller Shared folder contains views used by multiple controllers

View Rendering Views are.aspx files Derive from ViewPage, which derives from Page Have a ViewData dictionary property populated from the controller Still use markup, can still contain server-side script No server-side form required No VIEWSTATE No control state Strongly typed views Derive from ViewPage<T> instead of ViewPage Generic type parameter represents the type of the model.

Simple View <%@ Page Language="C# MasterPageFile="~/Views/Shared/Site.Master" %> <asp:content ID="indexContent" ContentPlaceHolderID="MainContent" runat="server"> <h2><%= Html.Encode(ViewData["Message"]) %></h2> </asp:content>

ViewPage<T> public class ProcessController : Controller { public ActionResult Index() { var data = from p in Process.GetProcesses() select p; } } return View(data); public partial class Index : ViewPage<IEnumerable<System.Diagnostics.Process>> <% foreach (var process in ViewData.Model) { %> <li> <%= Html.Encode(process.ProcessName) %> </li> <% } %>

View Helpers Helpers available via properties of ViewPage Property Class Description Ajax AjaxHelper Invoke controller actions asychronously and update client content Html HtmlHelper Create anchor tags, encode HTML Url UrlHelper Create URLs to invoke controller actions <%= Html.ActionLink("About Us", "About", "Home")%> <a href= /Home/About >About Us</a>

Action Filters Action filters are attributes applied to action methods Can execute code before and after action method Authorization Error handling Localization Logging Built in filter - OutputCacheAttribute Custom filters built by inheriting from ActionFilterAttribute

Unit Testing A Focus for ASP.NET MVC MVC Project Wizard can create associated test project Plays well with custom test frameworks NUnit, XUnit, MBUnit No hard dependencies HttpContext was a problem in testing web forms code-behind logic MVC uses abstract base classes and interfaces Can be mocked or stubbed for testing IViewEngine HttpSessionStateBase HttpContextBase

Resources Download ASP.NET MVC - http://aspnet.codeplex.com/ ASP.NET 1.0 ASP.NET 2.0 Preview 2 License Microsoft Public License (MS-PL) Also check out: MVCContrib (http://mvccontrib.org/) MVC T4 Tempalte (http://aspnet.codeplex.com)

Questions? http://odetocode.com/blogs/scott http://twitter.com/odetocode