INTRODUCTION TO ASP.NET MVC AND EXAMPLE WALKTHROUGH RAJAT ARYA EFECS - OIM DAWG – 4/21/2009 ASP.NET MVC.

Slides:



Advertisements
Similar presentations
Svetlin Nakov Director Training and Consulting Activities National Academy for Software Development (NASD) ASP.NET 3.5 New Features.
Advertisements

Malek Kemmou Technology Architect, Application Platform Microsoft Middle East and Africa Overview of ASP.NET 2.0.
ASP.NET Ajax Supplementary Tutorial. Why Use ASP.NET AJAX? - I ASP.NET AJAX enables you to build rich Web applications that have many advantages over.
.NET 3.5 SP1 New features Enhancements Visual Studio 2008 SP1 New features Enhancements Additional features/enhancements.
Introduction to ASP.NET MVC
Apache Struts Technology
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.
28/1/2001 Seminar in Databases in the Internet Environment Introduction to J ava S erver P ages technology by Naomi Chen.
Web Servers How do our requests for resources on the Internet get handled? Can they be located anywhere? Global?
Computer Science 101 Web Access to Databases Overview of Web Access to Databases.
Virtual techdays INDIA │ November 2010 ASP.Net MVC Deep Dive Sundararajan S │ Associate Tech Architect, Aditi Technologies.
AMS304: Introduction to the ASP.NET Model View Controller (MVC) Framework Scott Hanselman Eilon Lipton Microsoft Microsoft
Christopher M. Pascucci Basic Structural Concepts of.NET Browser – Server Interaction.
UNIT-V The MVC architecture and Struts Framework.
Ruby on Rails. What is Ruby on Rails? Ruby on Rails is an open source full-stack web framework. It is an alternative to PHP/MySQL. It can render templates,
1 Web Developer & Design Foundations with XHTML Chapter 6 Key Concepts.
Ori Calvo, 2010 “If people want to have maximum reach across *all* devices then HTML will provide the broadest reach” Scott Guthrie,
Tutorial: Introduction to ASP.NET Internet Technologies and Web Application 4 th February 2010.
M. Taimoor Khan * Java Server Pages (JSP) is a server-side programming technology that enables the creation of dynamic,
Architecture Of ASP.NET. What is ASP?  Server-side scripting technology.  Files containing HTML and scripting code.  Access via HTTP requests.  Scripting.
CIS 375—Web App Dev II ASP.NET 2 Introducing Web Forms.
Joe Hummel, PhD Dept of Mathematics and Computer Science Lake Forest College
An Introduction to ASP.NET Ed Dunhill blogs.msdn.com/edunhill SLIDE7.
Server-side Scripting Powering the webs favourite services.
Overview of Previous Lesson(s) Over View  ASP.NET Pages  Modular in nature and divided into the core sections  Page directives  Code Section  Page.
ASP.NET and Model View Control Jesper Tørresø ITNET2 F08.
RECALL THE MAIN COMPONENTS OF KIM Functional User Interfaces We just looked at these Reference Implementation We will talk about these later Service Interface.
ASP.NET Web Application and Development Digital Media Department Unit Credit Value : 4 Essential Learning time : 120 hours Digital.
ASP.NET Web Server Controls Basic Web Server Controls.
Introduction to ASP.NET 1www.tech.findforinfo.com.
Introduction to ASP.NET MVC Information for this presentation was taken from Pluralsight Building Applications with ASP.NET MVC 4.
ASP.NET.. ASP.NET Environment ASP.NET is Microsoft's programming framework that enables the development of Web applications and services. It is an easy.
Universiti Utara Malaysia Chapter 3 Introduction to ASP.NET 3.5.
Murach’s ASP.NET 4.0/VB, C1© 2006, Mike Murach & Associates, Inc.Slide 1.
Alcatel-Lucent CDC Workshop, Coaching & Knowledge Transfer Architecture.
Jonathan Canfield Mavin Lisa Giss Professor Kenytt D. Avery
Building Secure Web Applications With ASP.Net MVC.
Active Server Pages (ASP), also known as Classic ASP or ASP Classic, was Microsoft's first server-side script engine for dynamically generated web pages.
Model View Controller MVC Web Software Architecture.
Getting started with ASP.NET MVC Dhananjay
MVC WITH CODEIGNITER Presented By Bhanu Priya.
ASP. ASP is a powerful tool for making dynamic and interactive Web pages An ASP file can contain text, HTML tags and scripts. Scripts in an ASP file are.
Fundamentals of Web DevelopmentRandy Connolly and Ricardo HoarFundamentals of Web DevelopmentRandy Connolly and Ricardo Hoar Fundamentals of Web DevelopmentRandy.
 An essential supporting structure of any thing  A Software Framework  Has layered structure ▪ What kind of functions and how they interrelate  Has.
Overview of Previous Lesson(s) Over View  ASP is a technology that enables scripts in web pages to be executed by an Internet server.  ASP.NET is a.
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,
Virtual techdays INDIA │ 9-11 February 2011 SESSION TITLE Kamala Rajan S │ Technical Manager, Marlabs.
Introduction to ASP.NET development. Background ASP released in 1996 ASP supported for a minimum 10 years from Windows 8 release ASP.Net 1.0 released.
A S P. Outline  The introduction of ASP  Why we choose ASP  How ASP works  Basic syntax rule of ASP  ASP’S object model  Limitations of ASP  Summary.
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.
A Detailed Introduction To Visual Studio.NET CRB Tech ReviewsCRB Tech Reviews introduces you to the world of Visual.
1 Using MVC 6. MVC vs. ASP Web Forms Both run under ASP.NET Can coexist In Web Forms, browser requests page. xxx.aspx and xxx.aspx.cs on the server Page.
Chapter 1 Getting Started with ASP.NET Objectives Why ASP? To get familiar with our IDE (Integrated Development Environment ), Visual Studio. Understand.
Jim Fawcett CSE686 – Internet Programming Spring 2014
Managing State Chapter 13.
Introduction to .NET Florin Olariu
An introduction to ASP.Net with MVC Nischal S
Jim Fawcett CSE686 – Internet Programming Spring 2012
Social Media And Global Computing Introduction to The MVC Pattern
Introduction to ASP.NET 2.0
Haritha Dasari Josue Balandrano Coronel -
Controllers.
Serpil TOK, Zeki BAYRAM. Eastern MediterraneanUniversity Famagusta
ASP.NET MVC Imran Rashid CTO at ManiWeber Technologies.
Introduction to ASP.NET Parts 1 & 2
Presentation transcript:

INTRODUCTION TO ASP.NET MVC AND EXAMPLE WALKTHROUGH RAJAT ARYA EFECS - OIM DAWG – 4/21/2009 ASP.NET MVC

Agenda Definition  what is ASP.NET MVC? Functional Description  how does ASP.NET MVC actually work? Goal / Benefits  why is it important? ASP.NET MVC Implementation Walkthrough  lets see this thing actually working Questions? Reference Materials 2 4/21/ Rajat Arya - DAWG

ASP.NET MVC Definition 4/21/ Rajat Arya - DAWG 3 The ASP.NET MVC framework provides an alternative to the ASP.NET Web Forms pattern for creating MVC- based Web applications. The ASP.NET MVC framework is a lightweight, highly testable presentation framework that is integrated with existing ASP.NET features, such as master pages and membership-based authentication. The MVC framework is defined in the System.Web.Mvc namespace and is a fundamental, supported part of the System.Web namespace. (taken from

Functional Description (is a) 4/21/ Rajat Arya - DAWG 4 Set of classes, containing:  Base class for Controllers  Base class for Views (extend ASP.NET View class)  Base class for Responses (ActionResult)  Default classes for Routing (wiring URLs to Controllers) Plugin for Visual Studio  Adds project template

Functional Description (how it works) 4/21/ Rajat Arya - DAWG 5 Registers itself with ASP.NET in Default.aspx.cs as an HttpHandler and then handles all HTTP requests public partial class _Default : Page { public void Page_Load(object sender, System.EventArgs e) { HttpContext.Current.RewritePath(Request.ApplicationPath, false); IHttpHandler httpHandler = new MvcHttpHandler(); httpHandler.ProcessRequest(HttpContext.Current); } Enables Routing System through web.config changes

Functional Description (the parts) 4/21/ Rajat Arya - DAWG 6 Views  Display the application's user interface (UI).  Typically, this UI is created from the model data  Ex. an edit view of a Products table that displays text boxes, drop-down lists, and check boxes based on the current state of a Products object. Controllers  Handle user interaction, work with the model, and ultimately select a view to render that displays UI.  Handles and responds to user input and interaction  Ex. handles query-string values, and passes these values to the model, which in turn queries the database by using the values. Routing  Define rules to route URLs to specific Controllers.  Providing inputs to specific Actions defined by the Controller.  Ex. could be routed to ActionResult ProductsController.Information(int id) methodhttp:// (parts taken from

Functional Description (Views) 4/21/ Rajat Arya - DAWG 7 A view is a standard (X)HTML document that can contain scripts. Can be defined as an.aspx page, but no codebehind Example: \Views\Home\Index.aspx Index The current date and time is

Functional Description (Controllers) 4/21/ Rajat Arya - DAWG 8 Class that extends System.Web.Mvc.Controller class Defines public methods that return ActionResult for Actions the controller handles Each ActionResult method accepts inputs, does the processing (works with Model / Repository / Business Logic Layer) and returns ActionResult to user A View is returned as a ViewResult from the Controller Example: ProductsController public class ProductsController : Controller { // GET: /Products/ public ActionResult Index() { // Add action logic here return View(); }

Functional Description (Routing) 4/21/ Rajat Arya - DAWG 9 Responsible for mapping browser requests to a particular MVC Controller action. Enabled in web.config file Route table created in Global.asax file, called in Application_Start() method public static void RegisterRoutes(RouteCollection routes) { routes.MapRoute( "Default", // Unique route name "{controller}/{action}/{id}", // URL with parameters new { controller = "Home", action = "Index", id = "" } // defaults ); routes.MapRoute( "ProductInfo", "Products/Info/{id}", new { controller = "Products", action = "Info", id = "" } // defaults ); }

Functional Description (Passing Data) 4/21/ Rajat Arya - DAWG 10 ViewData object is used to pass data between Controllers and Views ViewData is a dictionary object, which has a Model property on it of type object  Use dictionary to pass data back, or use model object to set a model that the View is to display Controller does the following:  return View(“ViewName”, model);  ViewData[“id”] = 23; return View();

Functional Definition (request to response) 4/21/ Rajat Arya - DAWG URL request for /products/info/1 2. Default.aspx.cs invokes MvcHttpHandler to handle request 3. MvcHttpHandler refers to Routing Rules registered in Global.asax.cs (in Application_Start) to find a Controller/Action that matches request (/products/info/{id}) 4. MvcHttpHandler instantiates controller and invokes corresponding action method (using built in object mapper to map parameters on URL as inputs to action method) 5. Calls ProductsController.Info(id=1) code 6. Info method works with Business Logic objects to perform operation, sets any ViewData and returns a View as an ActionResult

Goals / Benefits (1) 4/21/ Rajat Arya - DAWG 12 Separation of Concerns  Separation of application tasks (input logic, business logic, and UI logic)  Does not use view state or server-based forms. Testability  All core contracts in the MVC framework are interface-based and can be tested by using mock objects, which are simulated objects that imitate the behavior of actual objects in the application  You can unit-test the application without having to run the controllers in an ASP.NET process, which makes unit testing fast and flexible. You can use any unit-testing framework that is compatible with the.NET Framework. Extensibility  All core contracts in the MVC framework are interface-based  Supports the use of Dependency Injection (DI) and Inversion of Control (IOC) container models.  Plug in your own view engine, URL routing policy, action-method parameter serialization, and other components. Compatibility  ASP.NET MVC lets you use features such as forms authentication and Windows authentication, URL authorization, membership and roles, output and data caching, session and profile state management, health monitoring, the configuration system, and the provider architecture.  You can use existing ASP.NET features with the ASP.NET MVC framework, such as nested master pages, in-line expressions ( ), declarative server controls, templates, data-binding, localization, and so on. (parts taken from

Goals / Benefits (2) 4/21/ Rajat Arya - DAWG 13 Powerful URL Mapping Component  Uses a Front Controller pattern that processes Web application requests through a single controller. This enables you to design an application that supports a rich routing infrastructure. For more information, see Front Controller on the MSDN Web site.Front Controller  URLs do not have to include file-name extensions, and are designed to support URL naming patterns that work well for search engine optimization (SEO) and representational state transfer (REST) addressing. Well Documented and Lots of Active Development Fully Supported by Microsoft Open-Source under MS-PL license Free! (parts taken from

ASP.NET MVC Implementation Walkthrough 4/21/ Rajat Arya - DAWG 14 Small sample ASP.NET MVC application. Taken from asp.net/mvc website ( ntactManager_7_CS.zip)

QUESTIONS? Fin.

Reference Materials 4/21/ Rajat Arya - DAWG really well done – go here first! ASP.NET/default.aspx - Scott Guthrie’s posts, goodness, code, ASP.NET/default.aspx x?category=ASP.NET+MVC – Scott Hanselman’s posts, good, less code x?category=ASP.NET+MVC Unity/IoC Running on IIS6 (or here) Running on IIS6here