SlideShare a Scribd company logo
1 of 21
Getting Started with ASP.NET MVC
Housekeeping Stuttering 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/
HattanShobokshi Senior Software Engineer www.hattanshobokshi.com hattan@gmail.com http://speakerrate.com/hattan Who am I?
Goals for this talk  Present an overview of ASP.NET MVC MVC vsWebforms. Why? What is the MVC paradigm? Controllers and Action Methods Views Html Helpers Models Model Binding Routing Best 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 MVC Current Version is MVC3. MVC2 and MVC3 are extension of MVC1. MVC1 and MVC2  - .NET Framework 3.5 & 4.0 MVC3 4.0 ONLY Visual Studio Tooling Support Convention over configuration What is ASP.NET MVC
What is MVC?
Why should I use ASP.NET MVC?  Testability Model Binder is awesome! No Viewstate SEO friendly url’s Complete control over Html output Easier integration with Jquery Better Separation of Concerns
ASP.NET Web Forms Traditional urlhttp://www.yoursite.com/admin/menu.aspx
ASP.NET MVC http://www.yoursite.com/admin/menu Admin is not a folder, but a class called AdminController Menu is not a file, but a Method in the AdminController Class
DEMO
Routing Route engine parses url’s, extracts any data and sends it off to controller Create extremely customizable routes Route table defines routes  in global.asax You 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
Views No Code behind Action 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 Helpers Html 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 Binding Takes data from an html form and creates an object. No need to write plumbing code
Best Practices Never 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 helper Add namespace to web.config so you don’t have to keep referencing it on each page The difference between routing name and class name.
Where can I get it? http://www.asp.net/mvc/download/ http://www.microsoft.com/express/Web/
Resources http://www.asp.net/learn/mvc/ http://www.asp.net/learn/mvc-videos/ Pro ASP.NET MVC Framework by Steven Sanderson Asp.net mvc Forumshttp://forums.asp.net/1146.aspx http://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 Methods Views Html Helpers Models Model Binding Routing Best Practices
The End Thank you!

More Related Content

What's hot (9)

Joomla Extensions Kung Fu
Joomla Extensions Kung FuJoomla Extensions Kung Fu
Joomla Extensions Kung Fu
 
Get satrted angular js
Get satrted angular jsGet satrted angular js
Get satrted angular js
 
Angular js Classes in Pune
Angular js Classes in PuneAngular js Classes in Pune
Angular js Classes in Pune
 
W3 schools javascript quiz test
W3 schools javascript quiz testW3 schools javascript quiz test
W3 schools javascript quiz test
 
ASP.NET Web Forms vs. MVC
ASP.NET Web Forms vs. MVCASP.NET Web Forms vs. MVC
ASP.NET Web Forms vs. MVC
 
Walther Mvc
Walther MvcWalther Mvc
Walther Mvc
 
Android MVVM
Android MVVMAndroid MVVM
Android MVVM
 
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!
 
Android MVVM
Android MVVMAndroid MVVM
Android MVVM
 

Viewers also liked

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 ncubeMalisa 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 6Ido Flatow
 
ASP.NET MVC Performance
ASP.NET MVC PerformanceASP.NET MVC Performance
ASP.NET MVC Performancerudib
 
ASP.NET MVC Presentation
ASP.NET MVC PresentationASP.NET MVC Presentation
ASP.NET MVC PresentationVolkan Uzun
 

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
 
Asp.Net MVC Intro
Asp.Net MVC IntroAsp.Net MVC Intro
Asp.Net MVC Intro
 
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
 
ASP.NET MVC Performance
ASP.NET MVC PerformanceASP.NET MVC Performance
ASP.NET MVC Performance
 
Model View Controller (MVC)
Model View Controller (MVC)Model View Controller (MVC)
Model View Controller (MVC)
 
ASP.NET MVC Presentation
ASP.NET MVC PresentationASP.NET MVC Presentation
ASP.NET MVC Presentation
 

Similar to Getting Started with ASP.NET MVC

Introduction To Mvc
Introduction To MvcIntroduction To Mvc
Introduction To MvcVolkan 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.netConcetto 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 3Shahrzad Peyman
 
ASP.NET MVC Presentation
ASP.NET MVC PresentationASP.NET MVC Presentation
ASP.NET MVC Presentationivpol
 
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.0Shiju 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 - IndiandotnetIndiandotnet
 
ASP.net MVC CodeCamp Presentation
ASP.net MVC CodeCamp PresentationASP.net MVC CodeCamp Presentation
ASP.net MVC CodeCamp Presentationbuildmaster
 
Worry free web development
Worry free web developmentWorry free web development
Worry free web developmentEstelle 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 TutorialMongoDB
 
ASP.NET MVC introduction
ASP.NET MVC introductionASP.NET MVC introduction
ASP.NET MVC introductionTomi 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 Railscodeinmotion
 
report_vendor_connect
report_vendor_connectreport_vendor_connect
report_vendor_connectYash 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 GuideAlicia Buske
 
Welcome to IE8 - Integrating Your Site With Internet Explorer 8
Welcome to IE8 - Integrating Your Site With Internet Explorer 8Welcome to IE8 - Integrating Your Site With Internet Explorer 8
Welcome to IE8 - Integrating Your Site With Internet Explorer 8Lachlan Hardy
 

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

Introduction To Mvc
Introduction To MvcIntroduction To Mvc
Introduction To Mvc
 
MSDN - ASP.NET MVC
MSDN - ASP.NET MVCMSDN - ASP.NET MVC
MSDN - ASP.NET MVC
 
Php and-mvc
Php and-mvcPhp and-mvc
Php and-mvc
 
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
 
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
 
ASP.NET MVC Presentation
ASP.NET MVC PresentationASP.NET MVC Presentation
ASP.NET MVC Presentation
 
Pcs global (4)
Pcs global (4)Pcs global (4)
Pcs global (4)
 
ASP.NET MVC 3
ASP.NET MVC 3ASP.NET MVC 3
ASP.NET MVC 3
 
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
 
MVC
MVCMVC
MVC
 
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
 
ASP.net MVC CodeCamp Presentation
ASP.net MVC CodeCamp PresentationASP.net MVC CodeCamp Presentation
ASP.net MVC CodeCamp Presentation
 
Day1
Day1Day1
Day1
 
Worry free web development
Worry free web developmentWorry free web development
Worry free web development
 
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
 
ASP.NET MVC introduction
ASP.NET MVC introductionASP.NET MVC introduction
ASP.NET MVC introduction
 
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
 
report_vendor_connect
report_vendor_connectreport_vendor_connect
report_vendor_connect
 
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
 
Welcome to IE8 - Integrating Your Site With Internet Explorer 8
Welcome to IE8 - Integrating Your Site With Internet Explorer 8Welcome to IE8 - Integrating Your Site With Internet Explorer 8
Welcome to IE8 - Integrating Your Site With Internet Explorer 8
 

Recently uploaded

Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxLoriGlavin3
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionDilum Bandara
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxBkGupta21
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxLoriGlavin3
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfPrecisely
 

Recently uploaded (20)

Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An Introduction
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptx
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
 

Getting Started with ASP.NET MVC

  • 1. Getting Started with ASP.NET MVC
  • 2. Housekeeping Stuttering 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/
  • 3. HattanShobokshi Senior Software Engineer www.hattanshobokshi.com hattan@gmail.com http://speakerrate.com/hattan Who am I?
  • 4. Goals for this talk Present an overview of ASP.NET MVC MVC vsWebforms. Why? What is the MVC paradigm? Controllers and Action Methods Views Html Helpers Models Model Binding Routing Best 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 MVC Current Version is MVC3. MVC2 and MVC3 are extension of MVC1. MVC1 and MVC2 - .NET Framework 3.5 & 4.0 MVC3 4.0 ONLY Visual Studio Tooling Support Convention over configuration What is ASP.NET MVC
  • 7.
  • 8. Why should I use ASP.NET MVC? Testability Model Binder is awesome! No Viewstate SEO friendly url’s Complete control over Html output Easier integration with Jquery Better Separation of Concerns
  • 9. ASP.NET Web Forms Traditional urlhttp://www.yoursite.com/admin/menu.aspx
  • 10. ASP.NET MVC http://www.yoursite.com/admin/menu Admin is not a folder, but a class called AdminController Menu is not a file, but a Method in the AdminController Class
  • 11. DEMO
  • 12. Routing Route engine parses url’s, extracts any data and sends it off to controller Create extremely customizable routes Route table defines routes in global.asax You 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. Views No Code behind Action 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 Helpers Html 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 Binding Takes data from an html form and creates an object. No need to write plumbing code
  • 17. Best Practices Never 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 helper Add namespace to web.config so you don’t have to keep referencing it on each page The 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. Resources http://www.asp.net/learn/mvc/ http://www.asp.net/learn/mvc-videos/ Pro ASP.NET MVC Framework by Steven Sanderson Asp.net mvc Forumshttp://forums.asp.net/1146.aspx http://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 Methods Views Html Helpers Models Model Binding Routing Best Practices

Editor's Notes

  1. 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