SlideShare a Scribd company logo
Getting Started with ASP.NET MVC
HousekeepingStuttering is a communication disorder involving disruptions, or “disfluencies,” in a person’s speech.Across all cultures, roughly 1% of people currently has a stuttering disorder.http://westutter.org/
HattanShobokshiSenior Software Engineerwww.hattanshobokshi.comhattan@gmail.comhttp://speakerrate.com/hattanWho am I?
Goals for this talk Present an overview of ASP.NET MVCMVC vsWebforms. Why?What is the MVC paradigm?Controllers and Action MethodsViewsHtml HelpersModelsModel BindingRoutingBest Practices
A new web development framework that allows you to develop web applications on the Microsoft stack using an MVC Architecture.Is NOT a replacement for traditional ASP.NET web forms.Web Forms vs MVCCurrent Version is MVC3.MVC2 and MVC3 are extension of MVC1.MVC1 and MVC2  - .NET Framework 3.5 & 4.0MVC3 4.0 ONLYVisual Studio Tooling SupportConvention over configurationWhat is ASP.NET MVC
What is MVC?
Getting Started with ASP.NET MVC
Why should I use ASP.NET MVC? TestabilityModel Binder is awesome!No ViewstateSEO friendly url’sComplete control over Html outputEasier integration with JqueryBetter Separation of Concerns
ASP.NET Web FormsTraditional urlhttp://www.yoursite.com/admin/menu.aspx
ASP.NET MVChttp://www.yoursite.com/admin/menuAdmin is not a folder, but a class called AdminControllerMenu is not a file, but a Method in the AdminController Class
DEMO
RoutingRoute engine parses url’s, extracts any data and sends it off to controllerCreate extremely customizable routesRoute table defines routes  in global.asaxYou do not need to define a route to handle querystring parameters. They are automatically mapped.
Model The model is the representation of your data.Business Logic
ViewsNo Code behindAction methods by default call views with the same name. (Convention over configuration)Views are not tied to a specific action method or controller.Views should be dumb (shouldn’t contain any application logic, only rendering logic)Views can be strongly typed
Html HelpersHtml helpers are extension methods that generate html. @Html.TextBox(“Name”,”Bob”)Html helpers are NOT controls, they simply generate html markup (strings)You can create your own Html Helper.
Model BindingTakes data from an html form and creates an object.No need to write plumbing code
Best PracticesNever include a hard reference in the view(eg <script src=“../js/jquery.js”></script>)instead use url.content like so<script src=“<%=Url.Content(“~/js/jquery.js”)%>”></script>)Never have big if then else in view, put it in an html helperAdd namespace to web.config so you don’t have to keep referencing it on each pageThe difference between routing name and class name.
Where can I get it?http://www.asp.net/mvc/download/http://www.microsoft.com/express/Web/
Resourceshttp://www.asp.net/learn/mvc/http://www.asp.net/learn/mvc-videos/Pro ASP.NET MVC Framework by Steven SandersonAsp.net mvc Forumshttp://forums.asp.net/1146.aspxhttp://haacked.com/
What did we just talk about? Present an overview of ASP.NET MVC MVC vsWebforms. Why?What is the MVC paradigm?Controllers and Action MethodsViewsHtml HelpersModelsModel BindingRoutingBest Practices
The EndThank you!

More Related Content

What's hot (9)

Joomla Extensions Kung Fu
Joomla Extensions Kung FuJoomla Extensions Kung Fu
Joomla Extensions Kung Fu
Oleg Nesterov
 
Get satrted angular js
Get satrted angular jsGet satrted angular js
Get satrted angular js
Alexandre Marreiros
 
Angular js Classes in Pune
Angular js Classes in PuneAngular js Classes in Pune
Angular js Classes in Pune
harshclassboat
 
W3 schools javascript quiz test
W3 schools javascript quiz testW3 schools javascript quiz test
W3 schools javascript quiz test
Himansu Sekhar Swain
 
ASP.NET Web Forms vs. MVC
ASP.NET Web Forms vs. MVCASP.NET Web Forms vs. MVC
ASP.NET Web Forms vs. MVC
Harish Ranganathan
 
Walther Mvc
Walther MvcWalther Mvc
Walther Mvc
rsnarayanan
 
Android MVVM
Android MVVMAndroid MVVM
Android MVVM
Vinícius Tonial Sossella
 
A Good PHP Framework For Beginners Like Me!
A Good PHP Framework For Beginners Like Me!A Good PHP Framework For Beginners Like Me!
A Good PHP Framework For Beginners Like Me!
Muhammad Ghazali
 
Android MVVM
Android MVVMAndroid MVVM
Android MVVM
David Estivariz Pierola
 

Viewers also liked (6)

ASP.NET MVC Best Practices malisa ncube
ASP.NET MVC Best Practices   malisa ncubeASP.NET MVC Best Practices   malisa ncube
ASP.NET MVC Best Practices malisa ncube
Malisa Ncube
 
Asp.Net MVC Intro
Asp.Net MVC IntroAsp.Net MVC Intro
Asp.Net MVC Intro
Stefano Paluello
 
Learning ASP.NET 5 and MVC 6
Learning ASP.NET 5 and MVC 6Learning ASP.NET 5 and MVC 6
Learning ASP.NET 5 and MVC 6
Ido Flatow
 
ASP.NET MVC Performance
ASP.NET MVC PerformanceASP.NET MVC Performance
ASP.NET MVC Performance
rudib
 
Model View Controller (MVC)
Model View Controller (MVC)Model View Controller (MVC)
Model View Controller (MVC)
Javier Antonio Humarán Peñuñuri
 
ASP.NET MVC Presentation
ASP.NET MVC PresentationASP.NET MVC Presentation
ASP.NET MVC Presentation
Volkan Uzun
 
ASP.NET MVC Best Practices malisa ncube
ASP.NET MVC Best Practices   malisa ncubeASP.NET MVC Best Practices   malisa ncube
ASP.NET MVC Best Practices malisa ncube
Malisa Ncube
 
Learning ASP.NET 5 and MVC 6
Learning ASP.NET 5 and MVC 6Learning ASP.NET 5 and MVC 6
Learning ASP.NET 5 and MVC 6
Ido Flatow
 
ASP.NET MVC Performance
ASP.NET MVC PerformanceASP.NET MVC Performance
ASP.NET MVC Performance
rudib
 
ASP.NET MVC Presentation
ASP.NET MVC PresentationASP.NET MVC Presentation
ASP.NET MVC Presentation
Volkan Uzun
 
Ad

Similar to Getting Started with ASP.NET MVC (20)

MVC Interview Questions PDF By ScholarHat
MVC Interview Questions PDF By ScholarHatMVC Interview Questions PDF By ScholarHat
MVC Interview Questions PDF By ScholarHat
Scholarhat
 
Introduction To Mvc
Introduction To MvcIntroduction To Mvc
Introduction To Mvc
Volkan Uzun
 
MSDN - ASP.NET MVC
MSDN - ASP.NET MVCMSDN - ASP.NET MVC
MSDN - ASP.NET MVC
Maarten Balliauw
 
Php and-mvc
Php and-mvcPhp and-mvc
Php and-mvc
Manoj Sahoo
 
Which is better asp.net mvc vs asp.net
Which is better  asp.net mvc vs asp.netWhich is better  asp.net mvc vs asp.net
Which is better asp.net mvc vs asp.net
Concetto Labs
 
Object Oriented Programming with Laravel - Session 3
Object Oriented Programming with Laravel - Session 3Object Oriented Programming with Laravel - Session 3
Object Oriented Programming with Laravel - Session 3
Shahrzad Peyman
 
ASP.NET MVC Presentation
ASP.NET MVC PresentationASP.NET MVC Presentation
ASP.NET MVC Presentation
ivpol
 
Pcs global (4)
Pcs global (4)Pcs global (4)
Pcs global (4)
Suraj Soni
 
ASP.NET MVC 3
ASP.NET MVC 3ASP.NET MVC 3
ASP.NET MVC 3
joselinoneto
 
TDD with ASP.NET MVC 1.0
TDD with ASP.NET MVC 1.0TDD with ASP.NET MVC 1.0
TDD with ASP.NET MVC 1.0
Shiju Varghese
 
MVC
MVCMVC
MVC
akshin
 
MVC From Beginner to Advance in Indian Style by - Indiandotnet
MVC From Beginner to Advance in Indian Style by - IndiandotnetMVC From Beginner to Advance in Indian Style by - Indiandotnet
MVC From Beginner to Advance in Indian Style by - Indiandotnet
Indiandotnet
 
ASP.net MVC CodeCamp Presentation
ASP.net MVC CodeCamp PresentationASP.net MVC CodeCamp Presentation
ASP.net MVC CodeCamp Presentation
buildmaster
 
Day1
Day1Day1
Day1
Avanish Sanchi
 
Worry free web development
Worry free web developmentWorry free web development
Worry free web development
Estelle Weyl
 
MongoDB.local Dallas 2019: MongoDB Stitch Tutorial
MongoDB.local Dallas 2019: MongoDB Stitch TutorialMongoDB.local Dallas 2019: MongoDB Stitch Tutorial
MongoDB.local Dallas 2019: MongoDB Stitch Tutorial
MongoDB
 
ASP.NET MVC introduction
ASP.NET MVC introductionASP.NET MVC introduction
ASP.NET MVC introduction
Tomi Juhola
 
MVC Demystified: Essence of Ruby on Rails
MVC Demystified: Essence of Ruby on RailsMVC Demystified: Essence of Ruby on Rails
MVC Demystified: Essence of Ruby on Rails
codeinmotion
 
report_vendor_connect
report_vendor_connectreport_vendor_connect
report_vendor_connect
Yash Mittal
 
ASP.NET MVC 5 Building Your First Web Application (A Beginner S Guide
ASP.NET MVC 5  Building Your First Web Application (A Beginner S GuideASP.NET MVC 5  Building Your First Web Application (A Beginner S Guide
ASP.NET MVC 5 Building Your First Web Application (A Beginner S Guide
Alicia Buske
 
MVC Interview Questions PDF By ScholarHat
MVC Interview Questions PDF By ScholarHatMVC Interview Questions PDF By ScholarHat
MVC Interview Questions PDF By ScholarHat
Scholarhat
 
Introduction To Mvc
Introduction To MvcIntroduction To Mvc
Introduction To Mvc
Volkan Uzun
 
Which is better asp.net mvc vs asp.net
Which is better  asp.net mvc vs asp.netWhich is better  asp.net mvc vs asp.net
Which is better asp.net mvc vs asp.net
Concetto Labs
 
Object Oriented Programming with Laravel - Session 3
Object Oriented Programming with Laravel - Session 3Object Oriented Programming with Laravel - Session 3
Object Oriented Programming with Laravel - Session 3
Shahrzad Peyman
 
ASP.NET MVC Presentation
ASP.NET MVC PresentationASP.NET MVC Presentation
ASP.NET MVC Presentation
ivpol
 
Pcs global (4)
Pcs global (4)Pcs global (4)
Pcs global (4)
Suraj Soni
 
TDD with ASP.NET MVC 1.0
TDD with ASP.NET MVC 1.0TDD with ASP.NET MVC 1.0
TDD with ASP.NET MVC 1.0
Shiju Varghese
 
MVC From Beginner to Advance in Indian Style by - Indiandotnet
MVC From Beginner to Advance in Indian Style by - IndiandotnetMVC From Beginner to Advance in Indian Style by - Indiandotnet
MVC From Beginner to Advance in Indian Style by - Indiandotnet
Indiandotnet
 
ASP.net MVC CodeCamp Presentation
ASP.net MVC CodeCamp PresentationASP.net MVC CodeCamp Presentation
ASP.net MVC CodeCamp Presentation
buildmaster
 
Worry free web development
Worry free web developmentWorry free web development
Worry free web development
Estelle Weyl
 
MongoDB.local Dallas 2019: MongoDB Stitch Tutorial
MongoDB.local Dallas 2019: MongoDB Stitch TutorialMongoDB.local Dallas 2019: MongoDB Stitch Tutorial
MongoDB.local Dallas 2019: MongoDB Stitch Tutorial
MongoDB
 
ASP.NET MVC introduction
ASP.NET MVC introductionASP.NET MVC introduction
ASP.NET MVC introduction
Tomi Juhola
 
MVC Demystified: Essence of Ruby on Rails
MVC Demystified: Essence of Ruby on RailsMVC Demystified: Essence of Ruby on Rails
MVC Demystified: Essence of Ruby on Rails
codeinmotion
 
report_vendor_connect
report_vendor_connectreport_vendor_connect
report_vendor_connect
Yash Mittal
 
ASP.NET MVC 5 Building Your First Web Application (A Beginner S Guide
ASP.NET MVC 5  Building Your First Web Application (A Beginner S GuideASP.NET MVC 5  Building Your First Web Application (A Beginner S Guide
ASP.NET MVC 5 Building Your First Web Application (A Beginner S Guide
Alicia Buske
 
Ad

Recently uploaded (20)

No-Code Workflows for CAD & 3D Data: Scaling AI-Driven Infrastructure
No-Code Workflows for CAD & 3D Data: Scaling AI-Driven InfrastructureNo-Code Workflows for CAD & 3D Data: Scaling AI-Driven Infrastructure
No-Code Workflows for CAD & 3D Data: Scaling AI-Driven Infrastructure
Safe Software
 
War_And_Cyber_3_Years_Of_Struggle_And_Lessons_For_Global_Security.pdf
War_And_Cyber_3_Years_Of_Struggle_And_Lessons_For_Global_Security.pdfWar_And_Cyber_3_Years_Of_Struggle_And_Lessons_For_Global_Security.pdf
War_And_Cyber_3_Years_Of_Struggle_And_Lessons_For_Global_Security.pdf
biswajitbanerjee38
 
FIDO Alliance Seminar State of Passkeys.pptx
FIDO Alliance Seminar State of Passkeys.pptxFIDO Alliance Seminar State of Passkeys.pptx
FIDO Alliance Seminar State of Passkeys.pptx
FIDO Alliance
 
FIDO Seminar: Targeting Trust: The Future of Identity in the Workforce.pptx
FIDO Seminar: Targeting Trust: The Future of Identity in the Workforce.pptxFIDO Seminar: Targeting Trust: The Future of Identity in the Workforce.pptx
FIDO Seminar: Targeting Trust: The Future of Identity in the Workforce.pptx
FIDO Alliance
 
Viral>Wondershare Filmora 14.5.18.12900 Crack Free Download
Viral>Wondershare Filmora 14.5.18.12900 Crack Free DownloadViral>Wondershare Filmora 14.5.18.12900 Crack Free Download
Viral>Wondershare Filmora 14.5.18.12900 Crack Free Download
Puppy jhon
 
PyData - Graph Theory for Multi-Agent Integration
PyData - Graph Theory for Multi-Agent IntegrationPyData - Graph Theory for Multi-Agent Integration
PyData - Graph Theory for Multi-Agent Integration
barqawicloud
 
Oracle Cloud Infrastructure Generative AI Professional
Oracle Cloud Infrastructure Generative AI ProfessionalOracle Cloud Infrastructure Generative AI Professional
Oracle Cloud Infrastructure Generative AI Professional
VICTOR MAESTRE RAMIREZ
 
Your startup on AWS - How to architect and maintain a Lean and Mean account
Your startup on AWS - How to architect and maintain a Lean and Mean accountYour startup on AWS - How to architect and maintain a Lean and Mean account
Your startup on AWS - How to architect and maintain a Lean and Mean account
angelo60207
 
Kubernetes Security Act Now Before It’s Too Late
Kubernetes Security Act Now Before It’s Too LateKubernetes Security Act Now Before It’s Too Late
Kubernetes Security Act Now Before It’s Too Late
Michael Furman
 
TrustArc Webinar - 2025 Global Privacy Survey
TrustArc Webinar - 2025 Global Privacy SurveyTrustArc Webinar - 2025 Global Privacy Survey
TrustArc Webinar - 2025 Global Privacy Survey
TrustArc
 
Reducing Conflicts and Increasing Safety Along the Cycling Networks of East-F...
Reducing Conflicts and Increasing Safety Along the Cycling Networks of East-F...Reducing Conflicts and Increasing Safety Along the Cycling Networks of East-F...
Reducing Conflicts and Increasing Safety Along the Cycling Networks of East-F...
Safe Software
 
AudGram Review: Build Visually Appealing, AI-Enhanced Audiograms to Engage Yo...
AudGram Review: Build Visually Appealing, AI-Enhanced Audiograms to Engage Yo...AudGram Review: Build Visually Appealing, AI-Enhanced Audiograms to Engage Yo...
AudGram Review: Build Visually Appealing, AI-Enhanced Audiograms to Engage Yo...
SOFTTECHHUB
 
“From Enterprise to Makers: Driving Vision AI Innovation at the Extreme Edge,...
“From Enterprise to Makers: Driving Vision AI Innovation at the Extreme Edge,...“From Enterprise to Makers: Driving Vision AI Innovation at the Extreme Edge,...
“From Enterprise to Makers: Driving Vision AI Innovation at the Extreme Edge,...
Edge AI and Vision Alliance
 
Bridging the divide: A conversation on tariffs today in the book industry - T...
Bridging the divide: A conversation on tariffs today in the book industry - T...Bridging the divide: A conversation on tariffs today in the book industry - T...
Bridging the divide: A conversation on tariffs today in the book industry - T...
BookNet Canada
 
Crypto Super 500 - 14th Report - June2025.pdf
Crypto Super 500 - 14th Report - June2025.pdfCrypto Super 500 - 14th Report - June2025.pdf
Crypto Super 500 - 14th Report - June2025.pdf
Stephen Perrenod
 
Agentic AI: Beyond the Buzz- LangGraph Studio V2
Agentic AI: Beyond the Buzz- LangGraph Studio V2Agentic AI: Beyond the Buzz- LangGraph Studio V2
Agentic AI: Beyond the Buzz- LangGraph Studio V2
Shashikant Jagtap
 
Data Validation and System Interoperability
Data Validation and System InteroperabilityData Validation and System Interoperability
Data Validation and System Interoperability
Safe Software
 
The State of Web3 Industry- Industry Report
The State of Web3 Industry- Industry ReportThe State of Web3 Industry- Industry Report
The State of Web3 Industry- Industry Report
Liveplex
 
Edge-banding-machines-edgeteq-s-200-en-.pdf
Edge-banding-machines-edgeteq-s-200-en-.pdfEdge-banding-machines-edgeteq-s-200-en-.pdf
Edge-banding-machines-edgeteq-s-200-en-.pdf
AmirStern2
 
cnc-drilling-dowel-inserting-machine-drillteq-d-510-english.pdf
cnc-drilling-dowel-inserting-machine-drillteq-d-510-english.pdfcnc-drilling-dowel-inserting-machine-drillteq-d-510-english.pdf
cnc-drilling-dowel-inserting-machine-drillteq-d-510-english.pdf
AmirStern2
 
No-Code Workflows for CAD & 3D Data: Scaling AI-Driven Infrastructure
No-Code Workflows for CAD & 3D Data: Scaling AI-Driven InfrastructureNo-Code Workflows for CAD & 3D Data: Scaling AI-Driven Infrastructure
No-Code Workflows for CAD & 3D Data: Scaling AI-Driven Infrastructure
Safe Software
 
War_And_Cyber_3_Years_Of_Struggle_And_Lessons_For_Global_Security.pdf
War_And_Cyber_3_Years_Of_Struggle_And_Lessons_For_Global_Security.pdfWar_And_Cyber_3_Years_Of_Struggle_And_Lessons_For_Global_Security.pdf
War_And_Cyber_3_Years_Of_Struggle_And_Lessons_For_Global_Security.pdf
biswajitbanerjee38
 
FIDO Alliance Seminar State of Passkeys.pptx
FIDO Alliance Seminar State of Passkeys.pptxFIDO Alliance Seminar State of Passkeys.pptx
FIDO Alliance Seminar State of Passkeys.pptx
FIDO Alliance
 
FIDO Seminar: Targeting Trust: The Future of Identity in the Workforce.pptx
FIDO Seminar: Targeting Trust: The Future of Identity in the Workforce.pptxFIDO Seminar: Targeting Trust: The Future of Identity in the Workforce.pptx
FIDO Seminar: Targeting Trust: The Future of Identity in the Workforce.pptx
FIDO Alliance
 
Viral>Wondershare Filmora 14.5.18.12900 Crack Free Download
Viral>Wondershare Filmora 14.5.18.12900 Crack Free DownloadViral>Wondershare Filmora 14.5.18.12900 Crack Free Download
Viral>Wondershare Filmora 14.5.18.12900 Crack Free Download
Puppy jhon
 
PyData - Graph Theory for Multi-Agent Integration
PyData - Graph Theory for Multi-Agent IntegrationPyData - Graph Theory for Multi-Agent Integration
PyData - Graph Theory for Multi-Agent Integration
barqawicloud
 
Oracle Cloud Infrastructure Generative AI Professional
Oracle Cloud Infrastructure Generative AI ProfessionalOracle Cloud Infrastructure Generative AI Professional
Oracle Cloud Infrastructure Generative AI Professional
VICTOR MAESTRE RAMIREZ
 
Your startup on AWS - How to architect and maintain a Lean and Mean account
Your startup on AWS - How to architect and maintain a Lean and Mean accountYour startup on AWS - How to architect and maintain a Lean and Mean account
Your startup on AWS - How to architect and maintain a Lean and Mean account
angelo60207
 
Kubernetes Security Act Now Before It’s Too Late
Kubernetes Security Act Now Before It’s Too LateKubernetes Security Act Now Before It’s Too Late
Kubernetes Security Act Now Before It’s Too Late
Michael Furman
 
TrustArc Webinar - 2025 Global Privacy Survey
TrustArc Webinar - 2025 Global Privacy SurveyTrustArc Webinar - 2025 Global Privacy Survey
TrustArc Webinar - 2025 Global Privacy Survey
TrustArc
 
Reducing Conflicts and Increasing Safety Along the Cycling Networks of East-F...
Reducing Conflicts and Increasing Safety Along the Cycling Networks of East-F...Reducing Conflicts and Increasing Safety Along the Cycling Networks of East-F...
Reducing Conflicts and Increasing Safety Along the Cycling Networks of East-F...
Safe Software
 
AudGram Review: Build Visually Appealing, AI-Enhanced Audiograms to Engage Yo...
AudGram Review: Build Visually Appealing, AI-Enhanced Audiograms to Engage Yo...AudGram Review: Build Visually Appealing, AI-Enhanced Audiograms to Engage Yo...
AudGram Review: Build Visually Appealing, AI-Enhanced Audiograms to Engage Yo...
SOFTTECHHUB
 
“From Enterprise to Makers: Driving Vision AI Innovation at the Extreme Edge,...
“From Enterprise to Makers: Driving Vision AI Innovation at the Extreme Edge,...“From Enterprise to Makers: Driving Vision AI Innovation at the Extreme Edge,...
“From Enterprise to Makers: Driving Vision AI Innovation at the Extreme Edge,...
Edge AI and Vision Alliance
 
Bridging the divide: A conversation on tariffs today in the book industry - T...
Bridging the divide: A conversation on tariffs today in the book industry - T...Bridging the divide: A conversation on tariffs today in the book industry - T...
Bridging the divide: A conversation on tariffs today in the book industry - T...
BookNet Canada
 
Crypto Super 500 - 14th Report - June2025.pdf
Crypto Super 500 - 14th Report - June2025.pdfCrypto Super 500 - 14th Report - June2025.pdf
Crypto Super 500 - 14th Report - June2025.pdf
Stephen Perrenod
 
Agentic AI: Beyond the Buzz- LangGraph Studio V2
Agentic AI: Beyond the Buzz- LangGraph Studio V2Agentic AI: Beyond the Buzz- LangGraph Studio V2
Agentic AI: Beyond the Buzz- LangGraph Studio V2
Shashikant Jagtap
 
Data Validation and System Interoperability
Data Validation and System InteroperabilityData Validation and System Interoperability
Data Validation and System Interoperability
Safe Software
 
The State of Web3 Industry- Industry Report
The State of Web3 Industry- Industry ReportThe State of Web3 Industry- Industry Report
The State of Web3 Industry- Industry Report
Liveplex
 
Edge-banding-machines-edgeteq-s-200-en-.pdf
Edge-banding-machines-edgeteq-s-200-en-.pdfEdge-banding-machines-edgeteq-s-200-en-.pdf
Edge-banding-machines-edgeteq-s-200-en-.pdf
AmirStern2
 
cnc-drilling-dowel-inserting-machine-drillteq-d-510-english.pdf
cnc-drilling-dowel-inserting-machine-drillteq-d-510-english.pdfcnc-drilling-dowel-inserting-machine-drillteq-d-510-english.pdf
cnc-drilling-dowel-inserting-machine-drillteq-d-510-english.pdf
AmirStern2
 

Getting Started with ASP.NET MVC

  • 1. Getting Started with ASP.NET MVC
  • 2. HousekeepingStuttering is a communication disorder involving disruptions, or “disfluencies,” in a person’s speech.Across all cultures, roughly 1% of people currently has a stuttering disorder.http://westutter.org/
  • 4. Goals for this talk Present an overview of ASP.NET MVCMVC vsWebforms. Why?What is the MVC paradigm?Controllers and Action MethodsViewsHtml HelpersModelsModel BindingRoutingBest Practices
  • 5. A new web development framework that allows you to develop web applications on the Microsoft stack using an MVC Architecture.Is NOT a replacement for traditional ASP.NET web forms.Web Forms vs MVCCurrent Version is MVC3.MVC2 and MVC3 are extension of MVC1.MVC1 and MVC2 - .NET Framework 3.5 & 4.0MVC3 4.0 ONLYVisual Studio Tooling SupportConvention over configurationWhat is ASP.NET MVC
  • 8. Why should I use ASP.NET MVC? TestabilityModel Binder is awesome!No ViewstateSEO friendly url’sComplete control over Html outputEasier integration with JqueryBetter Separation of Concerns
  • 9. ASP.NET Web FormsTraditional urlhttp://www.yoursite.com/admin/menu.aspx
  • 10. ASP.NET MVChttp://www.yoursite.com/admin/menuAdmin is not a folder, but a class called AdminControllerMenu is not a file, but a Method in the AdminController Class
  • 11. DEMO
  • 12. RoutingRoute engine parses url’s, extracts any data and sends it off to controllerCreate extremely customizable routesRoute table defines routes in global.asaxYou do not need to define a route to handle querystring parameters. They are automatically mapped.
  • 13. Model The model is the representation of your data.Business Logic
  • 14. ViewsNo Code behindAction methods by default call views with the same name. (Convention over configuration)Views are not tied to a specific action method or controller.Views should be dumb (shouldn’t contain any application logic, only rendering logic)Views can be strongly typed
  • 15. Html HelpersHtml helpers are extension methods that generate html. @Html.TextBox(“Name”,”Bob”)Html helpers are NOT controls, they simply generate html markup (strings)You can create your own Html Helper.
  • 16. Model BindingTakes data from an html form and creates an object.No need to write plumbing code
  • 17. Best PracticesNever include a hard reference in the view(eg <script src=“../js/jquery.js”></script>)instead use url.content like so<script src=“<%=Url.Content(“~/js/jquery.js”)%>”></script>)Never have big if then else in view, put it in an html helperAdd namespace to web.config so you don’t have to keep referencing it on each pageThe difference between routing name and class name.
  • 18. Where can I get it?http://www.asp.net/mvc/download/http://www.microsoft.com/express/Web/
  • 19. Resourceshttp://www.asp.net/learn/mvc/http://www.asp.net/learn/mvc-videos/Pro ASP.NET MVC Framework by Steven SandersonAsp.net mvc Forumshttp://forums.asp.net/1146.aspxhttp://haacked.com/
  • 20. What did we just talk about? Present an overview of ASP.NET MVC MVC vsWebforms. Why?What is the MVC paradigm?Controllers and Action MethodsViewsHtml HelpersModelsModel BindingRoutingBest Practices

Editor's Notes

  • #7: Controller gets data from the model, Gives it to a view.Controller doesn’t care where model gets data, and likewise controller doesn’t care how the view renders.Each component only cares about itself. Easy to swap out.Benefits :Separation of ConcernsTestabilityEasy to modifyLack of ComplexityFlow:Request comes through. Controller class handles the request, fetching data from the model. Controller then sends that data to the View and the result is given to the framework for rendering