SlideShare une entreprise Scribd logo
1  sur  15
ASP.NET MVC
Controller




View                Model
•   The Routing module is responsible for mapping incoming browser requests to
    particular MVC controller actions
•   Two places to setup:
       Web.config file
       Global.asax file

        Would you like to use:
          /Products.aspx?CategoryID={3F2504E0-4F89-11D3-9A0C-0305E82C3301}
        Or:
          /Products/Books



                                                                                 7
How it works?
                                               The Controller asks the
                                               Model for data
      The request hits the
      controller
                                                                     2         Model

                1                                                        3
                                            Controller                       The Model gives the data back
 U                                                                                 to the Controller

  s
             The controller formats the data and
  e          passes them to the View                              4
                                                                                View
  r
                             5


                                   The view renders the HTML that
                                    needs to be sent to the client
• It’s the core of your application
• A place for business logic, data
  access, Validation ... etc
• A model is accessible by
  both controller and view
• Totally independent from the
  views or the controllers
Controller [C]
• Heart of the entire
  MVC architecture
• Responsible for
  Handling user
  interaction
View [V]
• Responsible for
  presentation, look &
  feel, formatting.… etc.
•   Handles the rendering of the view to UI (html);
•   Different view engines have different syntax
•   ASP.NET MVC3 have following Pre-included View Engines:
        Web Forms(ASPX)
        Razor
            Provides a different coding style than ASPX files.
            Files will have a CSHTML/VBHTML
            Main goal is to handle embedded .Net code more gracefully.
IS NOT
.
References
•Official website http://asp.net/mvc
•Source Code http://codeplex.com/aspnet
•Blogs
    o Scott Guthrie        http://weblogs.asp.net/scottgu
    o Rob Conrey                    http://blog.wekeroad.com
    o MVC Store Front      http://blog.wekeroad.com/mvc-storefront
    o Phil Haack           http://haacked.com
    o Scott Hanselman      http://hanselman.com
    o Stephen Walthler     http://weblogs.asp.net/stephenwalther

Contenu connexe

Tendances

Mvc 130330091359-phpapp01
Mvc 130330091359-phpapp01Mvc 130330091359-phpapp01
Mvc 130330091359-phpapp01
Jennie Gajjar
 

Tendances (20)

MVC(Model View Controller),Web,Enterprise,Mobile
MVC(Model View Controller),Web,Enterprise,MobileMVC(Model View Controller),Web,Enterprise,Mobile
MVC(Model View Controller),Web,Enterprise,Mobile
 
Principles of MVC for Rails Developers
Principles of MVC for Rails DevelopersPrinciples of MVC for Rails Developers
Principles of MVC for Rails Developers
 
Just a View: An Introduction To Model-View-Controller Pattern
Just a View:  An Introduction To Model-View-Controller PatternJust a View:  An Introduction To Model-View-Controller Pattern
Just a View: An Introduction To Model-View-Controller Pattern
 
Anypoint platform highlights
Anypoint platform highlightsAnypoint platform highlights
Anypoint platform highlights
 
Introduction to mvc architecture
Introduction to mvc architectureIntroduction to mvc architecture
Introduction to mvc architecture
 
Mule mule management console
Mule  mule management consoleMule  mule management console
Mule mule management console
 
Model view controller (mvc)
Model view controller (mvc)Model view controller (mvc)
Model view controller (mvc)
 
MVC - In Details
MVC - In DetailsMVC - In Details
MVC - In Details
 
ASP.NET MVC.
ASP.NET MVC.ASP.NET MVC.
ASP.NET MVC.
 
What is MVC?
What is MVC?What is MVC?
What is MVC?
 
Intro ASP MVC
Intro ASP MVCIntro ASP MVC
Intro ASP MVC
 
Mule anypoint enterprise security
Mule  anypoint enterprise securityMule  anypoint enterprise security
Mule anypoint enterprise security
 
Very basic of asp.net mvc with c#
Very basic of asp.net mvc with c#Very basic of asp.net mvc with c#
Very basic of asp.net mvc with c#
 
MVC Architecture
MVC ArchitectureMVC Architecture
MVC Architecture
 
An overview of microsoft mvc dot net
An overview of microsoft mvc dot netAn overview of microsoft mvc dot net
An overview of microsoft mvc dot net
 
Model View Controller
Model View ControllerModel View Controller
Model View Controller
 
MVC architecture
MVC architectureMVC architecture
MVC architecture
 
Mvc 130330091359-phpapp01
Mvc 130330091359-phpapp01Mvc 130330091359-phpapp01
Mvc 130330091359-phpapp01
 
Query in share point by mule
Query in share point by muleQuery in share point by mule
Query in share point by mule
 
Anypoint platform release highlights
Anypoint platform release highlightsAnypoint platform release highlights
Anypoint platform release highlights
 

Similaire à ASP.NET MVC Introduction

Similaire à ASP.NET MVC Introduction (20)

Web engineering - MVC
Web engineering - MVCWeb engineering - MVC
Web engineering - MVC
 
MVC architecture
MVC architectureMVC architecture
MVC architecture
 
Asp.net c# MVC-5 Training-Day-1 of Day-9
Asp.net c# MVC-5 Training-Day-1 of Day-9Asp.net c# MVC-5 Training-Day-1 of Day-9
Asp.net c# MVC-5 Training-Day-1 of Day-9
 
Mvc architecture
Mvc architectureMvc architecture
Mvc architecture
 
Getting started with MVC 5 and Visual Studio 2013
Getting started with MVC 5 and Visual Studio 2013Getting started with MVC 5 and Visual Studio 2013
Getting started with MVC 5 and Visual Studio 2013
 
Mvc part 1
Mvc part 1Mvc part 1
Mvc part 1
 
Introduction to ASP.NET Core MVC and the MVC Pattern.pptx
Introduction to ASP.NET Core MVC and the MVC Pattern.pptxIntroduction to ASP.NET Core MVC and the MVC Pattern.pptx
Introduction to ASP.NET Core MVC and the MVC Pattern.pptx
 
Architectural Design & Patterns
Architectural Design&PatternsArchitectural Design&Patterns
Architectural Design & Patterns
 
Asp 1a-aspnetmvc
Asp 1a-aspnetmvcAsp 1a-aspnetmvc
Asp 1a-aspnetmvc
 
Aspnetmvc 1
Aspnetmvc 1Aspnetmvc 1
Aspnetmvc 1
 
Web tier-framework-mvc
Web tier-framework-mvcWeb tier-framework-mvc
Web tier-framework-mvc
 
Software Design Patterns
Software Design PatternsSoftware Design Patterns
Software Design Patterns
 
Single page application 03
Single page application   03Single page application   03
Single page application 03
 
MVC 4
MVC 4MVC 4
MVC 4
 
Technoligent providing custom ASP.NET MVC development services
Technoligent providing custom ASP.NET MVC development servicesTechnoligent providing custom ASP.NET MVC development services
Technoligent providing custom ASP.NET MVC development services
 
Asp 1-mvc introduction
Asp 1-mvc introductionAsp 1-mvc introduction
Asp 1-mvc introduction
 
App Project Planning, by Apple
App Project Planning, by AppleApp Project Planning, by Apple
App Project Planning, by Apple
 
MVC
MVCMVC
MVC
 
Asp.net,mvc
Asp.net,mvcAsp.net,mvc
Asp.net,mvc
 
MVC Seminar Presantation
MVC Seminar PresantationMVC Seminar Presantation
MVC Seminar Presantation
 

Dernier

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
Enterprise Knowledge
 

Dernier (20)

Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 

ASP.NET MVC Introduction

  • 2.
  • 4.
  • 5.
  • 6.
  • 7. The Routing module is responsible for mapping incoming browser requests to particular MVC controller actions • Two places to setup:  Web.config file  Global.asax file Would you like to use: /Products.aspx?CategoryID={3F2504E0-4F89-11D3-9A0C-0305E82C3301} Or: /Products/Books 7
  • 8. How it works? The Controller asks the Model for data The request hits the controller 2 Model 1 3 Controller The Model gives the data back U to the Controller s The controller formats the data and e passes them to the View 4 View r 5 The view renders the HTML that needs to be sent to the client
  • 9. • It’s the core of your application • A place for business logic, data access, Validation ... etc • A model is accessible by both controller and view • Totally independent from the views or the controllers
  • 10. Controller [C] • Heart of the entire MVC architecture • Responsible for Handling user interaction
  • 11. View [V] • Responsible for presentation, look & feel, formatting.… etc.
  • 12. Handles the rendering of the view to UI (html); • Different view engines have different syntax • ASP.NET MVC3 have following Pre-included View Engines:  Web Forms(ASPX)  Razor  Provides a different coding style than ASPX files.  Files will have a CSHTML/VBHTML  Main goal is to handle embedded .Net code more gracefully.
  • 14. .
  • 15. References •Official website http://asp.net/mvc •Source Code http://codeplex.com/aspnet •Blogs o Scott Guthrie http://weblogs.asp.net/scottgu o Rob Conrey http://blog.wekeroad.com o MVC Store Front http://blog.wekeroad.com/mvc-storefront o Phil Haack http://haacked.com o Scott Hanselman http://hanselman.com o Stephen Walthler http://weblogs.asp.net/stephenwalther

Notes de l'éditeur

  1. Here we are going to see following points;What is MVC – Conventional MVC and history of MVCWhy MVC is required i.e. downside of MVCHow MVC works i.e. framework and architecture of MVCRoutingView Engine(Razor)What ASP.NET MVC Can not
  2. It stands for Model view controller, i.e. input logic, business logic, and UI logic these three things plays an essential role in the development of any application Basically this is an design pattern which is being used since long time in programming development ;like JAVA, Ruby on Rails , Python, Spring, Struts,Java and Zend Framework , PHP, Mono RailDesign patternmeans an repeatable solution to commonly occurring problem.- One common programming problem; where we put code, what code goes where etc. MVC is solution that detects how to arrange your code based on what they are doing
  3. Why MVC is required in AS.NETWe have ASP.NET framework having RAD, rich library of controls like gridview, dataltst etc.Viewstate- ViewState maintains the state across postbacks- ViewState is powerful, but it has its drawbacks (weight,…)- Mechanism for maintaining state across requests results in large blocks of data being transferred between the client and server. Hundreds of kilobytes back and forth in every request2. Limited control over HTML- Server controls render as HTML, but not HTML you want; not as per web standard- Server control generate unpredictable and complex IDs values that are hard to access using Javascript3. Page life cycle- Page life cycle can be nightmare, it is very confusing when we uses controls4. Unit Testing- The ASP.NET behind code is completely tied up with ASP.NET Http context object which makes unit testing very difficult. 5. Separation of code & UI- Code behind code is different and the UI is different but then they are only separate physical files and one cannot just exist without other.
  4. A “Framework” built on top of Asp.net core framework. Microsoft has two frameworks for building web applications built on top of the ASP.NET framework: ASP.NET Web Forms and ASP.NET MVC By adapting MVC pattern, ASP.NET MVC framework provides strong competitions to ROR and similar platforms.
  5. Clear separation of logicIt makes it easier to manage complexity by dividing an application into the model, the view, and the controllerWhen you create an new ASP.NET MVC project, visual studio will create project template for us containing standard folder structure where we can put our jssscript,css etc.2. TDD- it provide development along with testingIt provides better support for test-driven development (TDD). Easier to unit test.ASP.NET MVC framework was designed to its core to support unit tests. Web applications written with the ASP.NET MVC framework are highly testableWhen we create new ASP.NET MVC project through visual studio it will provide us to create test project, but this is not compulsory3. No viewstateSo the size of such pages is much less than the same pages generated using the ASP.NET WebForm4. Full control over HTMLAs we have separate presentation layer so we have full control over HTML/cssJavascript developer will pleased to know that ASP.NET MVC meshes so well with jQueryIt is having in built support for jQuery5. ExtensibleModel, View, Controller classes are implemented from interface based technology so all are extremely flexible and extensible.Master page, Forms authentication, Membership and Role providers, Profiles, Internationalization and Cache
  6. How MVC pattern works;User will first request to controllerController class will ask Model for dataModel gives data back to controllerController formats data and passes it to viewView renders HTMLIn MVC, the behind code is moved to a simple .NET class called as controller. Any user request first comes to the controller class; the controller class then invokes the model and attaches the model to the view for display to the end user.
  7. It’s the core of your applicationMVC model is basically a C# or VB.NET classA place for business logic, data access, Validation ... etc.A model is accessible by both controller and view and can be used to pass data from Controller to viewTotally independent from the views or the controllers
  8. Heart of the entire MVC architectureController is basically a C# or VB.NET class which inherits system.mvc.controllerConsisting of a set of action methods which are responsible for responding to browser OR calling views.Controller are responsible for Handling user interactionController can access and use model class to pass data to viewsController uses ViewData to pass any data to view
  9. View is an ASPX page or CSHTML without having a code behind fileResponsible for presentation, look & feel, formatting, sorting … etc. All page specific HTML generation and formatting can be done inside viewA request to view can be made only from a controller’s action methodNo View State, No Server ControlsCan be extended by implementing View Engines
  10. ASP.NET WebForm’ssubstitute Fit RADFit every projectFit everyone