際際滷

際際滷Share a Scribd company logo
ASP.NET MVC CRUSH COURSEERDEM ERG聴N
MVC Pattern  What is it?MVC - Acronym for Model/View/ControllerInvented by TrygveReenskaug[1973 - 1978]Originally used as an architectural pattern for GUIs.The first implementation of MVC was as part of Smalltalk-80 class library.
MVC Pattern  How does it work?The Controller asks the Model for dataThe request hits the controllerModel213ControllerUserThe Model gives the data back to the ControllerThe controller formats the data and passes them to the ViewView45The view renders the HTML that needs to be sent to the client3
MVC Pattern  Who uses it?.NET has Spring.NET, MonoRailJava has Swing, Struts, Grails and othersPerl has Catalyst, Gantry, Jifty and othersPHP has Zend, Zoop, Agavi and othersPython has Django, Gluon, Pylon and othersRuby has Ruby on RailsApple has cocoa and cocoa touch for objective-c [Mac, iPhone]
MVC FrameworkHistoryBased on Python1970S.2003 RoR{ ASP.NET MVC }2009.3 MVC1 2010.4 MVC2
ASP.NET MVCIts not a replacement for asp.net webforms, its a new option [flavor]
 No more postbacks and ViewStates
 Built on top of ASP.NETAdvantagesClean URLs and HTML
More control over your html and JavaScript
Friendly URLS
More easily Testable Framework.
All ASP.Net providers still work [Membership, Session, Caching, etc]
Extensible and Pluggable [Support replacing any component]ASP.NET MVC Framework StructureASP.NET Abstractions(System.Web.Abstractions.dll)ASP.NET Routing(System.Web.Routing.dll)ASP.NET MVC(System.Web.Mvc.dll)
ASP.NET MVC Execution Process
DEMOCreate New ASP.NET MVC ProjectInvestigate ASP.NET MVC Structure
RoutingMVC+RR => the hidden character
ASP.NET MVC RoutingURL PatternsSetting Default Values for URL ParametersAdding Constraints to RoutesScenarios When Routing Is Not AppliedHow URLs Are Matched to RoutesAccessing URL Parameters in a Routed PageASP.NET Routing and SecurityASP.NET Routing versus URL Rewriting
Model [M]Validation
Controller [C]Controlling the flow of application execution
ASP.NET MVC ControllerController is a class consisting of a set of action methods. Responsible for Handling user interactionWorking with the modelsSelecting a view to renderSending model and information  to a particular viewMaking decisions for security, UI, redirects ... etc.The ASP.Net MVC requires the names of all controllers to end with the suffix  "Controller  e.g.  HomeController, LoginController
ASP.NET MVC ControllerA controller action always returns an ActionResultWhat if I return an object ??Action return ActionResult which can beViewResult		=> HTML and markup.
EmptyResult=> no result.
RedirectResult	=> redirection to a new URL.
JsonResult		=> json result that can be used in an AJAX application.
JavaScriptResult	=> JavaScript script.
ContentResult	=> text result [and wraps any non ActionResult return Type].
FileContentResult	=> downloadable file [with the binary content].
FilePathResult	=> downloadable file [with a path].
FileStreamResult	=> a downloadable file [with a file stream]. Note: all public methods of a controller class consideredas action methods, if you dont want a public method to be an action, mark it with [NonAction()] attribute
ASP.NET MVC Controller Filter
View [V]
ASP.NET MVC ViewResponsible for presentation, look & feel, formatting, sorting  etc. Interacts with model but shouldnt make decisions No logic should go thereCode Behind exists but not recommendedNo View State, No Server ControlsHTML HelpersTakes the view data from the controllerCan be strong typed  Can be extended by implementing View EnginesAlways build your views !!!
An HTML Helper is just a method that returns a string. Html.ActionLink() Html.BeginForm() Html.CheckBox() Html.DropDownList() Html.EndForm() Html.Hidden() Html.ListBox() Html.Password() Html.RadioButton() Html.TextArea() Html.TextBox()e.g.ASP.NET MVC View
Extensibility
The default ASP.NET MVC Pipeline21

More Related Content

What's hot (20)

Struts2
Struts2Struts2
Struts2
Rajiv Gupta
Introduction to ASP.NET MVC
Introduction to ASP.NET MVCIntroduction to ASP.NET MVC
Introduction to ASP.NET MVC
LearnNowOnline
ASP .net MVC
ASP .net MVCASP .net MVC
ASP .net MVC
Divya Sharma
Struts 1
Struts 1Struts 1
Struts 1
Lalit Garg
MSDN - ASP.NET MVC
MSDN - ASP.NET MVCMSDN - ASP.NET MVC
MSDN - ASP.NET MVC
Maarten Balliauw
Spring Web MVC
Spring Web MVCSpring Web MVC
Spring Web MVC
zeeshanhanif
ASP.NET MVC.
ASP.NET MVC.ASP.NET MVC.
ASP.NET MVC.
Ni
Introduction to Spring MVC
Introduction to Spring MVCIntroduction to Spring MVC
Introduction to Spring MVC
Richard Paul
Introduction to struts
Introduction to strutsIntroduction to struts
Introduction to struts
Mindfire Solutions
Unit testing and MVVM in Silverlight
Unit testing and MVVM in SilverlightUnit testing and MVVM in Silverlight
Unit testing and MVVM in Silverlight
Devnology
Jinal desai .net
Jinal desai .netJinal desai .net
Jinal desai .net
rohitkumar1987in
Real-world Model-View-ViewModel for WPF
Real-world Model-View-ViewModel for WPFReal-world Model-View-ViewModel for WPF
Real-world Model-View-ViewModel for WPF
Paul Stovell
Spring MVC Architecture Tutorial
Spring MVC Architecture TutorialSpring MVC Architecture Tutorial
Spring MVC Architecture Tutorial
Java Success Point
Mvc architecture
Mvc architectureMvc architecture
Mvc architecture
Surbhi Panhalkar
Struts ppt 1
Struts ppt 1Struts ppt 1
Struts ppt 1
pavanteja86
Introduction to mvc architecture
Introduction to mvc architectureIntroduction to mvc architecture
Introduction to mvc architecture
ravindraquicsolv
ASP .NET MVC Introduction & Guidelines
ASP .NET MVC Introduction & Guidelines  ASP .NET MVC Introduction & Guidelines
ASP .NET MVC Introduction & Guidelines
Dev Raj Gautam
Beginning AngularJS
Beginning AngularJSBeginning AngularJS
Beginning AngularJS
Troy Miles
Struts2
Struts2Struts2
Struts2
Scott Stanlick
Spring MVC Basics
Spring MVC BasicsSpring MVC Basics
Spring MVC Basics
Bozhidar Bozhanov
Introduction to ASP.NET MVC
Introduction to ASP.NET MVCIntroduction to ASP.NET MVC
Introduction to ASP.NET MVC
LearnNowOnline
ASP.NET MVC.
ASP.NET MVC.ASP.NET MVC.
ASP.NET MVC.
Ni
Introduction to Spring MVC
Introduction to Spring MVCIntroduction to Spring MVC
Introduction to Spring MVC
Richard Paul
Unit testing and MVVM in Silverlight
Unit testing and MVVM in SilverlightUnit testing and MVVM in Silverlight
Unit testing and MVVM in Silverlight
Devnology
Real-world Model-View-ViewModel for WPF
Real-world Model-View-ViewModel for WPFReal-world Model-View-ViewModel for WPF
Real-world Model-View-ViewModel for WPF
Paul Stovell
Spring MVC Architecture Tutorial
Spring MVC Architecture TutorialSpring MVC Architecture Tutorial
Spring MVC Architecture Tutorial
Java Success Point
Introduction to mvc architecture
Introduction to mvc architectureIntroduction to mvc architecture
Introduction to mvc architecture
ravindraquicsolv
ASP .NET MVC Introduction & Guidelines
ASP .NET MVC Introduction & Guidelines  ASP .NET MVC Introduction & Guidelines
ASP .NET MVC Introduction & Guidelines
Dev Raj Gautam
Beginning AngularJS
Beginning AngularJSBeginning AngularJS
Beginning AngularJS
Troy Miles

Similar to Asp.net mvc (20)

Inside asp.net mvc framework
Inside asp.net mvc frameworkInside asp.net mvc framework
Inside asp.net mvc framework
Ciklum Ukraine
Inside ASP.NET MVC framework
Inside ASP.NET MVC frameworkInside ASP.NET MVC framework
Inside ASP.NET MVC framework
Ciklum Ukraine
SoftServe - "ASP.NET MVC 磻 仆舒仗仆亳亶 从仂从 仂亰于亳从 亠仆仂仍仂亞 仂亰仂弍从亳 Web...
SoftServe - "ASP.NET MVC 磻 仆舒仗仆亳亶 从仂从  仂亰于亳从 亠仆仂仍仂亞 仂亰仂弍从亳 Web...SoftServe - "ASP.NET MVC 磻 仆舒仗仆亳亶 从仂从  仂亰于亳从 亠仆仂仍仂亞 仂亰仂弍从亳 Web...
SoftServe - "ASP.NET MVC 磻 仆舒仗仆亳亶 从仂从 仂亰于亳从 亠仆仂仍仂亞 仂亰仂弍从亳 Web...
SoftServe
8-9-10. ASP_updated8-9-10. ASP_updated8-9-10. ASP_updated
8-9-10. ASP_updated8-9-10. ASP_updated8-9-10. ASP_updated8-9-10. ASP_updated8-9-10. ASP_updated8-9-10. ASP_updated
8-9-10. ASP_updated8-9-10. ASP_updated8-9-10. ASP_updated
dioduong345
ASP.NET MVC Fundamental
ASP.NET MVC FundamentalASP.NET MVC Fundamental
ASP.NET MVC Fundamental
ldcphuc
Introduction To Mvc
Introduction To MvcIntroduction To Mvc
Introduction To Mvc
Volkan Uzun
Controllers & actions
Controllers & actionsControllers & actions
Controllers & actions
Eyal Vardi
Simple mvc4 prepared by gigin krishnan
Simple mvc4 prepared by gigin krishnanSimple mvc4 prepared by gigin krishnan
Simple mvc4 prepared by gigin krishnan
Gigin Krishnan
Build your website with angularjs and web apis
Build your website with angularjs and web apisBuild your website with angularjs and web apis
Build your website with angularjs and web apis
Chalermpon Areepong
CTTDNUG ASP.NET MVC
CTTDNUG ASP.NET MVCCTTDNUG ASP.NET MVC
CTTDNUG ASP.NET MVC
Barry Gervin
Asp.Net MVC Intro
Asp.Net MVC IntroAsp.Net MVC Intro
Asp.Net MVC Intro
Stefano Paluello
ASP.MVC Training
ASP.MVC TrainingASP.MVC Training
ASP.MVC Training
Mahesh Sikakolli
Introduction to ASP.NET MVC
Introduction to ASP.NET MVCIntroduction to ASP.NET MVC
Introduction to ASP.NET MVC
Sunpawet Somsin
MVC 4
MVC 4MVC 4
MVC 4
Vasilios Kuznos
Developing ASP.NET Applications Using the Model View Controller Pattern
Developing ASP.NET Applications Using the Model View Controller PatternDeveloping ASP.NET Applications Using the Model View Controller Pattern
Developing ASP.NET Applications Using the Model View Controller Pattern
goodfriday
angularJs Workshop
angularJs WorkshopangularJs Workshop
angularJs Workshop
Ran Wahle
Spring MVC 3.0 Framework
Spring MVC 3.0 FrameworkSpring MVC 3.0 Framework
Spring MVC 3.0 Framework
Ravi Kant Soni (ravikantsoni03@gmail.com)
ASp.net Mvc 5
ASp.net Mvc 5ASp.net Mvc 5
ASp.net Mvc 5
ahmedxp kh
ASP.NET MVC Extensibility
ASP.NET MVC ExtensibilityASP.NET MVC Extensibility
ASP.NET MVC Extensibility
Simone Chiaretta
AngularJs Workshop SDP December 28th 2014
AngularJs Workshop SDP December 28th 2014AngularJs Workshop SDP December 28th 2014
AngularJs Workshop SDP December 28th 2014
Ran Wahle
Inside asp.net mvc framework
Inside asp.net mvc frameworkInside asp.net mvc framework
Inside asp.net mvc framework
Ciklum Ukraine
Inside ASP.NET MVC framework
Inside ASP.NET MVC frameworkInside ASP.NET MVC framework
Inside ASP.NET MVC framework
Ciklum Ukraine
SoftServe - "ASP.NET MVC 磻 仆舒仗仆亳亶 从仂从 仂亰于亳从 亠仆仂仍仂亞 仂亰仂弍从亳 Web...
SoftServe - "ASP.NET MVC 磻 仆舒仗仆亳亶 从仂从  仂亰于亳从 亠仆仂仍仂亞 仂亰仂弍从亳 Web...SoftServe - "ASP.NET MVC 磻 仆舒仗仆亳亶 从仂从  仂亰于亳从 亠仆仂仍仂亞 仂亰仂弍从亳 Web...
SoftServe - "ASP.NET MVC 磻 仆舒仗仆亳亶 从仂从 仂亰于亳从 亠仆仂仍仂亞 仂亰仂弍从亳 Web...
SoftServe
8-9-10. ASP_updated8-9-10. ASP_updated8-9-10. ASP_updated
8-9-10. ASP_updated8-9-10. ASP_updated8-9-10. ASP_updated8-9-10. ASP_updated8-9-10. ASP_updated8-9-10. ASP_updated
8-9-10. ASP_updated8-9-10. ASP_updated8-9-10. ASP_updated
dioduong345
ASP.NET MVC Fundamental
ASP.NET MVC FundamentalASP.NET MVC Fundamental
ASP.NET MVC Fundamental
ldcphuc
Introduction To Mvc
Introduction To MvcIntroduction To Mvc
Introduction To Mvc
Volkan Uzun
Controllers & actions
Controllers & actionsControllers & actions
Controllers & actions
Eyal Vardi
Simple mvc4 prepared by gigin krishnan
Simple mvc4 prepared by gigin krishnanSimple mvc4 prepared by gigin krishnan
Simple mvc4 prepared by gigin krishnan
Gigin Krishnan
Build your website with angularjs and web apis
Build your website with angularjs and web apisBuild your website with angularjs and web apis
Build your website with angularjs and web apis
Chalermpon Areepong
CTTDNUG ASP.NET MVC
CTTDNUG ASP.NET MVCCTTDNUG ASP.NET MVC
CTTDNUG ASP.NET MVC
Barry Gervin
Introduction to ASP.NET MVC
Introduction to ASP.NET MVCIntroduction to ASP.NET MVC
Introduction to ASP.NET MVC
Sunpawet Somsin
Developing ASP.NET Applications Using the Model View Controller Pattern
Developing ASP.NET Applications Using the Model View Controller PatternDeveloping ASP.NET Applications Using the Model View Controller Pattern
Developing ASP.NET Applications Using the Model View Controller Pattern
goodfriday
angularJs Workshop
angularJs WorkshopangularJs Workshop
angularJs Workshop
Ran Wahle
ASp.net Mvc 5
ASp.net Mvc 5ASp.net Mvc 5
ASp.net Mvc 5
ahmedxp kh
ASP.NET MVC Extensibility
ASP.NET MVC ExtensibilityASP.NET MVC Extensibility
ASP.NET MVC Extensibility
Simone Chiaretta
AngularJs Workshop SDP December 28th 2014
AngularJs Workshop SDP December 28th 2014AngularJs Workshop SDP December 28th 2014
AngularJs Workshop SDP December 28th 2014
Ran Wahle

Asp.net mvc