SlideShare a Scribd company logo
ASP.Net edition
see you in the fall for our next edition
your sponsors
Free program dedicated to startups. Software & Tools to build
apps. You are invited, join: www.microsoft.com/bizspark
Get a FREE O’Reilly ebook of your choice! Limit one per
person per event: http://bit.ly/DenverDevDay
Introduction to
ASP.NET MVC
Joe Wilson,
Volare Systems, Inc.
volaresystems.com/blog
@joe_in_denver
Agenda
• Where does MVC fit in today’s web?
• Basics of MVC
• Routing
• Views
• Controllers/Actions
• Models
• MVC: The good parts
• Is MVC a fit for your project?
Today’s web, same old HTTP
Response
HTML, JSON, File, XML
Request
GET, POST
Browser
Client
Web
Server
Today’s web, more abstractions, libraries,
frameworks on top of HTTP
Response
HTML, JSON, File, XML
Request
GET, POST
Web Forms
MVC
Web API
Basics of MVC
M = Model
V = View
C = Controller
(R = Routing)
Basics of MVC - Routing
http://server/product/edit
Response
Request
ActionController
HTML, JSON, File, XML
Browser
Client
Web
Server
Basics of MVC - Routing
Routing Engine
Controller (Action)
View,
JSON, File,
XML
Model
Request (GET or POST)
Response
Basics of MVC - Routing
http://server/product/edit
ActionController
Folder View
Basics of MVC – Routing (Default route)
Basics of MVC – Routing (Route attributes)
Demo - Routing
Basics of MVC – Views
• Are .CSHTML files
• Hold user interface elements (HTML, CSS, JavaScript)
• Use _Layout.cshtml to style pages the same for entire app
• Show Model data with @Model.Something or
@ViewBag.Something
• Views should not contain much logic
• Simple “if”s or “foreach”es are OK
Basics of MVC – Views (_Layout.cshtml)
Basics of MVC – Views (Edit form)
Basics of MVC – Views
Basics of MVC – Controllers
• Are .CS files
• Hold commands and workflows in Actions (methods)
• Model bind values from form, query string, cookies, etc.
• Works with Models for small logic and data
• Validate user input before moving on
• Render Views, JSON, XML, RSS, File, etc.
Basics of MVC – Models
• Are .CS files or ViewBag, which is a dynamic type
• Can be TempData[“something”] for single-use values
• Data to display in the View and data posted from the View back to
the Controller
• Good place for validation attributes
• Good place for light, display-related logic (Full Name, Totals,
IsUserLoggedIn, etc.)
Basics of MVC – Validation and Scaffolding
Basics of MVC – Models (ViewBag)
In Controller/Action.. In View….
Demo – Views, Models, Scaffolding
and Model Binding
Basics of MVC – Security
Security
• Attributes on controller and/or action
• Allow Anonymous is the default
Demo – Security
MVC: The good parts
Separation of Concerns guidance
• Don’t dump all your code in HTML or code behind files
• MVC gives guidance about what kind of code goes where
• Convention over configuration
MVC: The good parts
Style Sheets, Images
Controllers
Models
JavaScript
Views
Layout
Tests
MVC: The good parts
Testability
• Putting as much logic as possible in POCOs leads to easier
testing
• HttpContext is hard to mock
• MVC provides mockable abstract classes
MVC: The good parts
Clean HTML
• MVC controls keep their IDs
• Easier to manipulate DOM with JavaScript and jQuery
• Easier to build accessible, Section 508 compliant sites
MVC: The good parts
HTML from Web Forms
<span
id="ctl00_MainContent_uxdPHAllContent_TripSelector_lblFromDate">
From Date:</span>
<input type="text"
name="ctl00$MainContent$uxdPHAllContent$TripSelector$txtFromDate"
id="ctl00_MainContent_uxdPHAllContent_TripSelector_txtFromDate" />
HTML from MVC
<label for="FromDate">From Date:</label>
<input type="text" name="FromDate" id="FromDate" />
MVC: The good parts
Headroom
• Extensible
• Custom Routing
• Custom View Engine
• Custom Model/Parameter Binders
• Custom Action Filters
• Custom Formatters
• All code is released as open source
MVC: The good parts
• Part of ASP.NET, same security model
• Can run side-by-side with Web Forms, SignalR, etc.
• Cookies, Session, Caching, etc. still work the same
Today’s web, where does MVC fit?
• ASP.NET security for pages
• Consistent look with a Layout page
• Model binding, server-side validation
• Easy to send data from the server with the view
Resources
•Microsoft site for MVC - asp.net/mvc
•Microsoft site for Web API - asp.net/web-api
•Pluralsight - pluralsight.com
volaresystems.com/blog
@joe_in_denver

More Related Content

PPTX
ASP .NET MVC - best practices
PPTX
Getting started with MVC 5 and Visual Studio 2013
PPT
MSDN - ASP.NET MVC
PPTX
ASP.NET MVC and ajax
PDF
Asp.net mvc basic introduction
PDF
About Flux
PPTX
ASP .NET MVC
PDF
ASP.NET MVC 3
ASP .NET MVC - best practices
Getting started with MVC 5 and Visual Studio 2013
MSDN - ASP.NET MVC
ASP.NET MVC and ajax
Asp.net mvc basic introduction
About Flux
ASP .NET MVC
ASP.NET MVC 3

What's hot (20)

PPTX
ASP.NET MVC 5 - EF 6 - VS2015
PDF
MVC 1.0 als alternative Webtechnologie
PPTX
Mortal Kombat! ASP.NET MVC vs ASP.NET Webforms – ASP.NET MVC is amazing
PPTX
Mvc framework
ODP
Mvc
PPT
MVC ppt presentation
PDF
Dot net interview questions and asnwers
PPTX
ASP.NET MVC for Begineers
PPT
Asp.net mvc
PPT
MVC Architecture in ASP.Net By Nyros Developer
PPTX
Flux architecture
PPTX
Asp.net MVC training session
PPTX
Introduction to ASP.NET MVC
PPT
ASP.NET MVC Presentation
PPTX
Asp.net mvc presentation by Nitin Sawant
PPT
Silver Light By Nyros Developer
PDF
PPT
MVC Pattern. Flex implementation of MVC
PPTX
ASP .Net MVC 5
PPTX
Asp.net mvc 5 course module 1 overview
ASP.NET MVC 5 - EF 6 - VS2015
MVC 1.0 als alternative Webtechnologie
Mortal Kombat! ASP.NET MVC vs ASP.NET Webforms – ASP.NET MVC is amazing
Mvc framework
Mvc
MVC ppt presentation
Dot net interview questions and asnwers
ASP.NET MVC for Begineers
Asp.net mvc
MVC Architecture in ASP.Net By Nyros Developer
Flux architecture
Asp.net MVC training session
Introduction to ASP.NET MVC
ASP.NET MVC Presentation
Asp.net mvc presentation by Nitin Sawant
Silver Light By Nyros Developer
MVC Pattern. Flex implementation of MVC
ASP .Net MVC 5
Asp.net mvc 5 course module 1 overview
Ad

Similar to Introduction to ASP.NET MVC (20)

PPTX
2011 NetUG HH: ASP.NET MVC & HTML 5
PPTX
Mvc Brief Overview
PPTX
Introduction to ASP.NET MVC 2
PPTX
Asp.net With mvc handson
PPTX
Aspnet mvc
PPTX
MVC Framework
PPTX
SoftServe - "ASP.NET MVC як наступний крок у розвитку технології розробки Web...
PPTX
Introduction to ASP.Net MVC
PPTX
PPTX
Sitecore MVC: What it is and why it's important
PPS
Introduction To Mvc
PPSX
Asp.net mvc
PPT
ASP.net MVC CodeCamp Presentation
PDF
Asp 1a-aspnetmvc
PDF
Aspnetmvc 1
PPTX
Using MVC with Kentico 8
PPTX
Asp.Net MVC Intro
PPTX
What is ASP.NET MVC
PPT
CTTDNUG ASP.NET MVC
PDF
Intro to ColdBox MVC at Japan CFUG
2011 NetUG HH: ASP.NET MVC & HTML 5
Mvc Brief Overview
Introduction to ASP.NET MVC 2
Asp.net With mvc handson
Aspnet mvc
MVC Framework
SoftServe - "ASP.NET MVC як наступний крок у розвитку технології розробки Web...
Introduction to ASP.Net MVC
Sitecore MVC: What it is and why it's important
Introduction To Mvc
Asp.net mvc
ASP.net MVC CodeCamp Presentation
Asp 1a-aspnetmvc
Aspnetmvc 1
Using MVC with Kentico 8
Asp.Net MVC Intro
What is ASP.NET MVC
CTTDNUG ASP.NET MVC
Intro to ColdBox MVC at Japan CFUG
Ad

More from Joe Wilson (7)

PPTX
Adding a timeline to your web app
PPTX
Boulder Tech Throwdown - Rails vs .NET
PPTX
MVC Views In Depth
PPTX
Whats New In Mvc 2
PPTX
Unit Testing And Mocking
PPTX
Intermediate ASP.NET MVC
PPTX
Introduction To ASP.Net MVC
Adding a timeline to your web app
Boulder Tech Throwdown - Rails vs .NET
MVC Views In Depth
Whats New In Mvc 2
Unit Testing And Mocking
Intermediate ASP.NET MVC
Introduction To ASP.Net MVC

Recently uploaded (20)

PPTX
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
PDF
System and Network Administration Chapter 2
PDF
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
PDF
Understanding Forklifts - TECH EHS Solution
PPTX
history of c programming in notes for students .pptx
PPTX
Embracing Complexity in Serverless! GOTO Serverless Bengaluru
PDF
Adobe Premiere Pro 2025 (v24.5.0.057) Crack free
PDF
Design an Analysis of Algorithms II-SECS-1021-03
PDF
Digital Systems & Binary Numbers (comprehensive )
PDF
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
PDF
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf
PDF
How to Migrate SBCGlobal Email to Yahoo Easily
PDF
wealthsignaloriginal-com-DS-text-... (1).pdf
PDF
Which alternative to Crystal Reports is best for small or large businesses.pdf
PDF
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
PPTX
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
PPTX
CHAPTER 2 - PM Management and IT Context
PDF
Digital Strategies for Manufacturing Companies
PDF
Navsoft: AI-Powered Business Solutions & Custom Software Development
PDF
Nekopoi APK 2025 free lastest update
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
System and Network Administration Chapter 2
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
Understanding Forklifts - TECH EHS Solution
history of c programming in notes for students .pptx
Embracing Complexity in Serverless! GOTO Serverless Bengaluru
Adobe Premiere Pro 2025 (v24.5.0.057) Crack free
Design an Analysis of Algorithms II-SECS-1021-03
Digital Systems & Binary Numbers (comprehensive )
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf
How to Migrate SBCGlobal Email to Yahoo Easily
wealthsignaloriginal-com-DS-text-... (1).pdf
Which alternative to Crystal Reports is best for small or large businesses.pdf
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
CHAPTER 2 - PM Management and IT Context
Digital Strategies for Manufacturing Companies
Navsoft: AI-Powered Business Solutions & Custom Software Development
Nekopoi APK 2025 free lastest update

Introduction to ASP.NET MVC

  • 1. ASP.Net edition see you in the fall for our next edition your sponsors Free program dedicated to startups. Software & Tools to build apps. You are invited, join: www.microsoft.com/bizspark Get a FREE O’Reilly ebook of your choice! Limit one per person per event: http://bit.ly/DenverDevDay
  • 2. Introduction to ASP.NET MVC Joe Wilson, Volare Systems, Inc. volaresystems.com/blog @joe_in_denver
  • 3. Agenda • Where does MVC fit in today’s web? • Basics of MVC • Routing • Views • Controllers/Actions • Models • MVC: The good parts • Is MVC a fit for your project?
  • 4. Today’s web, same old HTTP Response HTML, JSON, File, XML Request GET, POST Browser Client Web Server
  • 5. Today’s web, more abstractions, libraries, frameworks on top of HTTP Response HTML, JSON, File, XML Request GET, POST Web Forms MVC Web API
  • 6. Basics of MVC M = Model V = View C = Controller (R = Routing)
  • 7. Basics of MVC - Routing http://server/product/edit Response Request ActionController HTML, JSON, File, XML Browser Client Web Server
  • 8. Basics of MVC - Routing Routing Engine Controller (Action) View, JSON, File, XML Model Request (GET or POST) Response
  • 9. Basics of MVC - Routing http://server/product/edit ActionController Folder View
  • 10. Basics of MVC – Routing (Default route)
  • 11. Basics of MVC – Routing (Route attributes)
  • 13. Basics of MVC – Views • Are .CSHTML files • Hold user interface elements (HTML, CSS, JavaScript) • Use _Layout.cshtml to style pages the same for entire app • Show Model data with @Model.Something or @ViewBag.Something • Views should not contain much logic • Simple “if”s or “foreach”es are OK
  • 14. Basics of MVC – Views (_Layout.cshtml)
  • 15. Basics of MVC – Views (Edit form)
  • 16. Basics of MVC – Views
  • 17. Basics of MVC – Controllers • Are .CS files • Hold commands and workflows in Actions (methods) • Model bind values from form, query string, cookies, etc. • Works with Models for small logic and data • Validate user input before moving on • Render Views, JSON, XML, RSS, File, etc.
  • 18. Basics of MVC – Models • Are .CS files or ViewBag, which is a dynamic type • Can be TempData[“something”] for single-use values • Data to display in the View and data posted from the View back to the Controller • Good place for validation attributes • Good place for light, display-related logic (Full Name, Totals, IsUserLoggedIn, etc.)
  • 19. Basics of MVC – Validation and Scaffolding
  • 20. Basics of MVC – Models (ViewBag) In Controller/Action.. In View….
  • 21. Demo – Views, Models, Scaffolding and Model Binding
  • 22. Basics of MVC – Security Security • Attributes on controller and/or action • Allow Anonymous is the default
  • 24. MVC: The good parts Separation of Concerns guidance • Don’t dump all your code in HTML or code behind files • MVC gives guidance about what kind of code goes where • Convention over configuration
  • 25. MVC: The good parts Style Sheets, Images Controllers Models JavaScript Views Layout Tests
  • 26. MVC: The good parts Testability • Putting as much logic as possible in POCOs leads to easier testing • HttpContext is hard to mock • MVC provides mockable abstract classes
  • 27. MVC: The good parts Clean HTML • MVC controls keep their IDs • Easier to manipulate DOM with JavaScript and jQuery • Easier to build accessible, Section 508 compliant sites
  • 28. MVC: The good parts HTML from Web Forms <span id="ctl00_MainContent_uxdPHAllContent_TripSelector_lblFromDate"> From Date:</span> <input type="text" name="ctl00$MainContent$uxdPHAllContent$TripSelector$txtFromDate" id="ctl00_MainContent_uxdPHAllContent_TripSelector_txtFromDate" /> HTML from MVC <label for="FromDate">From Date:</label> <input type="text" name="FromDate" id="FromDate" />
  • 29. MVC: The good parts Headroom • Extensible • Custom Routing • Custom View Engine • Custom Model/Parameter Binders • Custom Action Filters • Custom Formatters • All code is released as open source
  • 30. MVC: The good parts • Part of ASP.NET, same security model • Can run side-by-side with Web Forms, SignalR, etc. • Cookies, Session, Caching, etc. still work the same
  • 31. Today’s web, where does MVC fit? • ASP.NET security for pages • Consistent look with a Layout page • Model binding, server-side validation • Easy to send data from the server with the view
  • 32. Resources •Microsoft site for MVC - asp.net/mvc •Microsoft site for Web API - asp.net/web-api •Pluralsight - pluralsight.com volaresystems.com/blog @joe_in_denver