ASP.NET and Model View Control Jesper Tørresø ITNET2 F08.

Slides:



Advertisements
Similar presentations
Introduction to ASP.NET MVC
Advertisements

Apache Struts Technology
INTRODUCTION TO ASP.NET MVC AND EXAMPLE WALKTHROUGH RAJAT ARYA EFECS - OIM DAWG – 4/21/2009 ASP.NET MVC.
Introduction to MVC Adding a View Page NTPCUG Tom Perkins, Ph.D.
Fabian Vilers Hands on ASP.NET MVC.
ASP MVC s/mvc-4/getting-started-with- aspnet-mvc4/intro-to-aspnet- mvc-4.
Apache Tomcat Server Typical html Request/Response cycle
Application Architectures Vijayan Sugumaran Department of DIS Oakland University.
Session-01. Layers Struts 2 Framework The struts 2 framework is used to develop MVC-based web application. Struts 1.0 was released in June The.
Tutorial -01. Objective In this session we will discuss about : 1.What is MVC? 2.Why MVC? 3.Advantages of MVC over ASP.NET 4.ASP.NET development models.
AMS304: Introduction to the ASP.NET Model View Controller (MVC) Framework Scott Hanselman Eilon Lipton Microsoft Microsoft
Web Application Architecture: multi-tier (2-tier, 3-tier) & mvc
Christopher M. Pascucci Basic Structural Concepts of.NET Browser – Server Interaction.
Struts 2.0 an Overview ( )
UNIT-V The MVC architecture and Struts Framework.
Ori Calvo, 2010 “If people want to have maximum reach across *all* devices then HTML will provide the broadest reach” Scott Guthrie,
LAYING OUT THE FOUNDATIONS. OUTLINE Analyze the project from a technical point of view Analyze and choose the architecture for your application Decide.
MVC pattern and implementation in java
JavaScript & jQuery the missing manual Chapter 11
CIS 375—Web App Dev II ASP.NET 2 Introducing Web Forms.
ASP.NET + Ajax Jesper Tørresø ITNET2 F08. Ajax Ajax (Asynchronous JavaScript and XML) A group of interrelated web development techniques used for creating.
February 16, Aaron Cuffman Andy Nagle Adam Schultz Web Site.
MVC and MVP. References enter.html enter.html
Model View Controller (MVC) Rick Mercer with a wide variety of others 1.
Building Web Sites with ASP.NET MVC Framework Noam King CTO Sela College
Design Patterns Phil Smith 28 th November Design Patterns There are many ways to produce content via Servlets and JSPs Understanding the good, the.
JSP Architecture Outline  Model 1 Architecture  Model 2 Architecture.
JSF Introduction Copyright © Liferay, Inc. All Rights Reserved. No material may be reproduced electronically or in print without written permission.
Case Study + MVC Lec Error Pages By means of the page directive, a JSP can be given the responsibility of an Error page An Error JSP will be called.
Murach’s ASP.NET 4.0/VB, C1© 2006, Mike Murach & Associates, Inc.Slide 1.
Jonathan Canfield Mavin Lisa Giss Professor Kenytt D. Avery
Model View Controller (MVC) Bigger than a Pattern: It’s an Architecture Rick Mercer with help from many others 1.
Model View Controller Architecture of Java Web Applications Dr. M V S Peri Sastry, Ph.D.[BITS-Pilani]
Getting Started with ASP.NET MVC BRIJ BHUSHAN MISHRA.
Model View Controller MVC Web Software Architecture.
Christopher M. Pascucci.NET Programming CodeBehind.
Model View Controller (MVC) Bigger than a Pattern: It’s an Architecture Rick Mercer with help from many of others 1.
1 WWW. 2 World Wide Web Major application protocol used on the Internet Simple interface Two concepts –Point –Click.
ASP.Net MVC Extensibility, scalability and testability Andrew Locatelli Woodcock.
© FPT SOFTWARE – TRAINING MATERIAL – Internal use 04e-BM/NS/HDCV/FSOFT v2/3 JSP Application Models.
ASP.NET User Controls. User Controls In addition to using Web server controls in your ASP.NET Web pages, you can create your own custom, reusable controls.
MVC WITH CODEIGNITER Presented By Bhanu Priya.
1 Copyright © 2004, Oracle. All rights reserved. Oracle Application Development Framework.
ASP.NET MVC Telerik Academy
Model View Controller (MVC) an architecture Rick Mercer with help from many of others 1.
Mr. Justin “JET” Turner CSCI 3000 – Fall 2015 CRN Section A – TR 9:30-10:45 CRN – Section B – TR 5:30-6:45.
Introduction  “M” “V” “C” stands for “MODEL” “VIEW” “CONTROLLER”. ASP.NET MVC is an architecture to develop ASP.NET web applications in a different manner.
Virtual techdays INDIA │ 9 th – 11 th January 2011 ASP.Net MVC Sundararajan S │ Associate Tech Architect, Aditi Technologies.
ASP.NET MVC An Introduction. What is MVC The Model-View-Controller (MVC) is an architectural pattern separates an application into three main components:
Text INTRODUCTION TO ASP.NET. InterComm Campaign Guidelines CONFIDENTIAL Simply Server side language Simplified page development model Modular, well-factored,
PostBack  When an initial request for a page (a Web Form) is received by ASP.NET, it locates and loads the requested Web Form (and if necessary compiles.
Bayu Priyambadha, S.Kom. Static content  Web Server delivers contents of a file (html) 1. Browser sends request to Web Server 3. Web Server sends HTML.
Virtual techdays INDIA │ 9-11 February 2011 SESSION TITLE Kamala Rajan S │ Technical Manager, Marlabs.
JSP / Servlets and Beans
Apache Struts Technology A MVC Framework for Java Web Applications.
The New Face of ASP.NET ASP.NET MVC, Razor, and jQuery Ido Flatow | Senior Architect | Sela | This session is.
INTRODUCTION TO MVC BY SUHA MNEIMNEH. WHAT’S THE AGENDA What is MVC? MVC components MVC vs web forms vs ASP.NET vocabulary When to create MVC application.
111 State Management Beginning ASP.NET in C# and VB Chapter 4 Pages
Presented by Alexey Vedishchev Developing Web-applications with Grails framework American University of Nigeria, 2016 Intro To MVC Architecture.
© Copyright SELA software & Education Labs Ltd Baruch Hirsch St.Bnei Brak Israel
Model View Presenter Design Pattern Jay Smith PMO Architect and Evangelist Tyson Foods, Inc.
Introduction to MVC Slavomír Moroz. Revision from Previous Lesson o ASP.NET WebForms applications Abstract away HTTP (similar to desktop app development)
Jim Fawcett CSE686 – Internet Programming Spring 2014
Introduction to .NET Florin Olariu
Social Media And Global Computing Introduction to The MVC Pattern
Design and Maintenance of Web Applications in J2EE
Anatomy of an ASP.NET Page
Model-View-Controller Patterns and Frameworks
ASP.NET MVC Imran Rashid CTO at ManiWeber Technologies.
ASP.NET and Model View Control
Presentation transcript:

ASP.NET and Model View Control Jesper Tørresø ITNET2 F08

Turns around the usual way A MVC Controller takes control over from the standard ASP.NET Framework View Engine. From Scott Guthrie –”The MVC framework supports using the existing ASP.NET.ASPX,.ASCX, and.Master markup files as "view templates" (meaning you can easily use existing ASP.NET features like nested master pages, snippets, declarative server controls, templates, data-binding, localization, etc). It does not, however, use the existing post-back model for interactions back to the server. Instead, you'll route all end- user interactions to a Controller class instead - which helps ensure clean separation of concerns and testability (it also means no viewstate or page lifecycle with MVC based views). ”

But what about the existing ASP.NET framework? May we ”only” use HTML control and not server controls and/oe user controls? All HTML from controls may be used We can use the already known APS.NET server controls and also a special MVC User Control. (!!!!) But we must take care of routing etc by our self.

Model View Control JSP Model 1 architecture (from ) Is this original ASP.NET ?

Model View Control JSP Model 2 architecture

Model, View and Controller: The pattern MVC, which stands for Model-View-Controller, separates an application in three components: Model: this is where all the business logic of the application resides: it can range from a simple static class that returns a dataset to a complex multi-assembly Business Logic Layer that uses an assembly specific to the Data Access Layer. View: at the other end of the application is the View, which displays the application's user interface and contains the representation of the data that have been retrieved by the Model. This doesn't have logic, other than the one strictly related to the presentation of data. Controller: between the two components stands the Controller. It acts as the orchestrator of all the interactions among the other components and the users: it handles the requests, reads the form values, passes them to the Model, decides which View to render and finally sends the data to be rendered to the View.

Interaction 1.The request comes from the client and hits the Controller. 2.The Controller calls the Model in order to perform some "business" operations. 3.The Model returns the results of the operations back to the Controller. 4.The Controller decides which View needs to be rendered and sends it the data that must be rendered. 5.Finally the View renders the output and sends the response back to the client.

Model 2 and ASP.NET

URL Routning Normal ASP.NET – ASP.NET MVC – The URL’s are interpreted by a RouteHandler and known as routes to the Controller.

URL Routning 1 The URL patterns defined are called routes Ex: Valid route definitionsExamples of matching URL {controller}/{action}/{id}/Products/show/beverages {table}/Details.aspx/Products/Details.aspx blog/{action}/{entry}/blog/show/123 {reporttype}/{year}/{month}/{day}/sales/2008/1/5 Typically, you add routes in the handler for the Application_Start event in the Global.asax file. This approach makes sure that the routes are available when the application starts.

URL Routning 2 Initiating application in Global.asax.cs void Application_Start(object sender, EventArgs e) { RegisterRoutes(RouteTable.Routes); } public static void RegisterRoutes(RouteCollection routes) { routes.Add(new Route ( "Category/{action}/{categoryName}" new CategoryRouteHandler() ) { Defaults = new RouteValueDictionary {{"categoryName", "food"}, {"action", "show"}} } ); }

URL Routning 3 See more here – extensions/mvc/URLRouting.aspxhttp://quickstarts.asp.net/3-5- extensions/mvc/URLRouting.aspx Setting default values in Routes Adding constraints Routes Making a MVC route to a URL

Sow! What is ASP.NET MVC? ASP.NET MVC is a framework that allows developers to apply the MVC pattern in the development of an ASP.NET application, thus allowing a better separation of concerns, which results in better reusability and easier testing. MVC was one of the concepts originally found in SmallTalk. MVC and the web seem like a match made in heaven and allow for a simple way of building complex web applications. To understand why this recently re-discovered way of building web application was developed, we need to have a look at the pitfalls of the standard model, which is the web-form approach. –First, it is event based: it can be good or bad depending on how you look at it. Good because it helps VB6 and WinForms developers to smoothly migrate their skills to the web application development. Bad because there are dozens of events that are raised during the page life- cycle, and it's not trivial to understand where to put your code. Also because the process logic is tightly coupled with the page life- cycle, it is difficult to test using automated tests. Cont..

Sow! What is ASP.NET MVC? cont. –It also uses server forms and ViewState: again, as with the event based model, it can be good since this hides to the developer all the problems related to maintaining the state of the page (values of textboxes, contents of dropdowns and so on), but can also be bad if you want to control exactly how the page is rendered, and you don't need to maintain all the state. –Furthermore, it uses server controls: good because they render the HTML for you; bad since they render it the way they want. With the MVC framework you gain back the control of the order in which things happen during the page life-cycle, of the way state is persisted between requests, and the code with which HTML is rendered. And thanks to a better separation of concerns it's easier to test the process logic. But all this control has a cost: you have to do everything by yourself. Keep in mind this: the MVC framework is not a replacement for the web- form programming model, but it's an alternative programming model, for those who want to have a better control and want to be able to also test the presentation logic