ASP.NET Presentation

38 %
62 %
Information about ASP.NET Presentation

Published on March 8, 2014

Author: raselkhanprogrammer



This is ppt presentaion !!

JATIYA KABI KAZI NAZRUL ISLAM UNIVERSITY Presentation On Submitted to Mr. Tushar Kanti Saha Lecturer Deprt of CSE, JKKNIU Submitted By Rasel khan Roll: 11102027 Session: 2010-2011 Dept Of CSE

ASP.NET OVERVIEW  Introduction & History  Why use ASP.NET, Some characteristics & with Component  Steps for developing a web based application and how to work request with response.  Working with ASP.NET MVC Framework.  How to work HTTP Fundamentals.  ASP.NET web application Routing.  ASP.NET IIS & how to create virtual directory.

ASP.NET mean is Active Server Pages . It is a server-side Web application framework designed for Web development to produce dynamic Web pages .It was developed by Microsoft to allow programmers to build , • Dynamic web sites, • Web applications • Web services

• The latest version of ASP is known as ASP.NET • Visual Studio .NET is a developer application used to create ASP.NET Web applications • There are two main types of Web resources created with ASP.NET applications – Web Forms are ASP.NET pages within an ASP.NET application – Web Services are ASP.NET Web pages that contain publicly exposed code so that other applications can interact with them – Web Services are identified with the file extension .asmx

ASP.NET 1.0 was released on January 5, 2002 as part of version 1.0 of the .NET Framework. Scott Guthrie became the product unit manager for ASP.NET, and development continued apace, with version 1.1 being released on April 24, 2003 as a part of Windows Server 2003. This release focused on improving ASP.NET's support for mobile devices.

 Improved Performance and Scalability.  Compiled Execution, Rich Output Caching, Web Farm Session State.  Enhanced Reliability.  Memory Leak, Dead Lock, and Crash Protection  Easy Deployment.  No Touch" Application Deployment, Dynamic Update of Running Application, Easy Migration Path  New Application Models.  XML Web Services  Developer Productivity.  Easy Programming Model, Flexible Language Options, Rich Class Framework.

 Code-behind model  It is recommended by Microsoft for dealing with dynamic program code to use the code-behind model, which places this code in a separate file or in a specially designated script tag  User  controls ASP.NET supports creating reusable components through the creation of User Controls  Rendering technique  ASP.NET uses a visited composites rendering technique. During compilation, the template (.aspx) file is compiled into initialization code which builds a control tree (the composite) representing the original template

• Compiled code  Code written in ASP.NET is compile and not interpreted. • Enriched tool support  ASP.NET applications using visual studio • Power and flexibility  ASP.NET applications are based on the CLR • Simplicity  ASP.NET enables you to build user interfaces that separate application logic from presentation content • Manageability  ASP.NET provides a number of options in providing the above facilities

 Server control Respond to users events by running event procedures on the server.  HTML control Represent the standard visual elements provided in HTML  Data control Provide a way to connect to perform commands on and retrieve data from SQL , OL ,databases and XML data files  System components Provide access to various system level events that occur on the server

Step 1 – Step 2 Step 3 Step 4 Step 5 Step 6 Step 7 – – – – – – Create Local Folders for Your Web Project Create a Blank Solution Add a Web Site to Your Solution Add a Class Library (Optional) Check Your Solution Structure Check Your Local Folder Structure Add Your Solution to Source Control

Web Server Web Browser Get default.aspx 1. Client Initiates 2. Communications With page request Display page Server response with pages 1. Process request 2. Execute server slide code 3. Store session data 4. Send result response

ASP.NET MVC Model View Controller (MVC) applications by using the ASP.NET framework

WHAT IS ASP.NET MVC? Saying simply, ASP.NET MVC is a new framework from Microsoft that sits over standard ASP.NET engine. ASP.NET MVC ASP.NET

ASP.NET MVC Features 1. Clear separation of logic: Model, View, Controller 2. Test-Driven Development (TDD) 3. Full control over HTML and JavaScript 4. Friendly URLs

MODEL + VIEW + CONTROLLER = MVC ASP.NET MVC provides an alternative to the ASP.NET “Web Forms” pattern for creating MVC-based Web applications. Views display the application's user interface (UI). Typically, this UI is created from the model data. Model objects implement the logic for the application's data domain. Often, model objects retrieve and store the app state in a database. Model View Controller Controllers handle user interaction, work with the model, and select a view to render that displays UI

Test-Driven Development (TDD) Since the UI is completely separated from the business logic, it’s now easy to write Unit Tests for the ASP.NET MVC application. Unit Tests that cover User Actions and Data Model User Interface Controller Data Objects

Full control over HTML & JS In ASP.NET MVC, designed HTML & JS pages are not more messed up with “postbacks” and “ViewStates”, which is specific for “Web-forms” pattern. <input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPaA8FDzhjYjBhZjA0ODYyMTM2NBgGBR5fX0NvbnRyb2xzUmVxdWlyZVBvc3RCYWNr S2V5X18WAQUhY3RsMDAkaGVhZGVyJHVjTWFpbk1lbnUkc2VhcmNoQnRuBTdjdGwwMCRNYWl uQ29udGVudCRycHRWaWRlbyRjdGwwMyRwcmVzZW50YXRpb25DYXJkJG11bHRp" /> <script type="text/javascript"> //<![CDATA[ var theForm = document.forms['aspnetForm']; function __doPostBack(eventTarget, eventArgument) { if (!theForm.onsubmit || (theForm.onsubmit() != false)) { theForm.__EVENTTARGET.value = eventTarget; theForm.__EVENTARGUMENT.value = eventArgument; theForm.submit(); } } //]]> </script>

Friendly URLs MVC binds web paths to the logical URLs rather than to the physical files. Physical location: C:InetpubwwwrootWebSiteProducts.aspx ASP.NET style: at MVC style:

HOW DOES ASP.NET MVC LOOKS LIKE? ASP.NET MVC installs a new type of web project into VS2008.

A newly created project has an ASP.NET MVC specific directory structure. App_Data folder is the physical store for data. Content folder keeps files such as scripts, CSS, images, and so on. Controllers folder is the location for controllers. The MVC framework requires the names of all controllers to end with "Controller"—for example, HomeController, LoginController, or ProductController. Models stores classes that handle application business logic. Scripts folder is for script files that support the application. By default, this folder contains AJAX script files and the JQuery library. Views is the recommended location for views. Views use .aspx, .ascx, and .master files, in addition to any other files that are related to rendering views.

ASP.NET MVC supports pure MVC pattern, the same development pattern Rails are based on. The advantages of ASP.NET MVC applications: 1. It makes it easier to manage complexity by dividing an application into the model, the view, and the controller. 2. It does not use view state or server-based forms. 3. It 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 with friendly URLs. 4. It provides better support for test-driven development (TDD). 5. It works well for Web applications that are supported by large teams of developers and Web designers who need a high degree of control over the application behavior.

 - official site  - development basics on ASP.NET MVC  - URL routing used in ASP.NET MVC  interaction between Controllers and Views  - managing form input data

ASP.NET Web API and HTTP Fundamentals

CRAMMING YOUR BRAINS WITH HTTP & ASP.NET WEB API • HTTP Fundamentals via Web API • Dependency Resolver • HTTP Messages • URIs • HTTP.SYS • Routing • IIS 101 • Verbs • HTTP compression • Controllers and Actions • Persisted Connections • Status Codes • Web API Self Hosting • HttpRequestMessage HttpResponseMessage • Error Handling • Content Negotiation • Media Type Formatters • OData • Validations • • Hosting More HTTP and Web API • Caching • Concurrency • Security • Streaming • WebSockets & SignalR 26

WHY IS HTTP IMPORTANT?  HTTP is a first class application layer protocol  Unlike other protocols it was created to support a single information system  That system happened to be the largest and main information system of the human race: 27

NO REALLY, WHY? Today's systems face new challenges:  Broader reach of clients

What About ASP.NET Web API? • The .NET platform never had a first class framework for HTTP-based services • WCF was created as a SOAP-based framework and never really matured to support HTTP 29

THE HISTORY OF ASP.NET WEB API 6 Preview Versions WCF Web API on CodePlex WCF WebHttp Binding (.NET 4) ASP.NET Web API 4 Release ASP.NET is Open Source ASP.NET Web API 2 Release Candidate ASP.NET Web API (Beta) 30

HTTP Messages 101  HTTP is a first class application protocol:  Widely supported across platforms and devices  Scalable  Simple  Uses the request-response messaging pattern  Define resource-based semantics and not RPC (Remote Procedure Call) or methods 31

HTTP REQUEST MESSAGES GET http://localhost:2300/api/agents/Bond HTTP/1.1 Accept: text/html, application/xhtml+xml, */* Accept-Language: en-US,en;q=0.7,he;q=0.3 User-Agent: Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; WOW64; Trident/6.0) Accept-Encoding: gzip, deflate Host: localhost:2300 DNT: 1 Connection: Keep-Alive 32

HTTP RESPONSE MESSAGES HTTP/1.1 200 OK Cache-Control: public, max-age=300 Content-Type: application/json; charset=utf-8 ETag: "1" Server: Microsoft-IIS/8.0 X-AspNet-Version: 4.0.30319 Date: Mon, 19 Nov 2012 17:49:40 GMT Content-Length: 142 { "Id": "Bond", "FullName": "James Bond", "Alias": "007", "Version": 1, "Image": "http://localhost:2300/api/agents/Bond.jpg" } 33

URIS • HTTP is not an RPC protocol • HTTP uses URIs to identify resources over the network • An HTTP URI has the following basic structure: Schema Host Port Absolute Path Query 34

CLEAN URLS AND ASP.NET  Using clean URLs can be a problem with IIS  IIS needs extensions to map requests to handlers  Without extensions, IIS is lost  ASP.NET Routing to the rescue with UrlRoutingModule  It’s all about patterns… and mapping them to handlers  The starting point of MVC, Dynamic Data, and Web API  System.Web.Routing.RouteTable.Routes.MapHttpRoute RouteTable.Routes.MapHttpRoute( name: "DefaultApi", routeTemplate: "api/{controller}/{id}", defaults: new { id = RouteParameter.Optional } ); 35


Routing with attributes  Why attributes over convention?  Child (sub) resources  Multiple type of parameters or return values  Versioning of actions and controllers  Start by enabling attribute routing  config.MapHttpAttributeRoutes(); [RoutePrefix("api/agents/{agentId}")] public class ObservationsController : ApiController { // GET api/agents/bond/observations [HttpGet("observations/{date}")] public Observation Get(string agentId, DateTime date) { ... } }

Verbs • HTTP defines a set of Methods or Verbs that add an action-like semantics to requests • Verbs are defined as the first segment of • the request-line: GET http://localhost:4392/travelers/1 HTTP/1.1 • There are eight verbs defined in HTTP 1.1: GET POST PUT DELETE HEAD OPTIONS TRACE CONNECT 38

3, 2, 1, Actions! • Actions are matched by HTTP verb names and the existence of parameters public class ProductsController : ApiController { public IEnumerable<Product> GetProducts() {...} public Product GetProductById(int id) {...} public HttpResponseMessage PostProduct(Product product) {...} } GET api/products GET api/products/42 POST api/products DELETE api/products/42

Status Codes  Status codes describe the result of the server’s effort to satisfy the request  Passed in the response's status-line as three digit alongside a textual description called reason phrase  HTTP has five different categories of status-codes:      1xx – Informational 2xx – Success 3xx – Redirection 4xx – Client Error 5xx – Server Error (100 / 101) (200 – 206) (300 – 307) (400 – 417) (500 – 505)

Status Code examples • • • • • • • • 41 404? 401? 304? 503? 500? 200? 301? 302?

 Returning an HttpResponseMessage allows more control over the response, including:    Status code HTTP headers Entity body public HttpResponseMessage CreateAgent(Agent agent) { agent = _repository.Add(agent); var response = Request.CreateResponse<Agent>(HttpStatusCode.Created, agent); response.Headers.Location = GetAgentLocation(agent.Id); return response; } 42

Error Handling • In HTTP services errors are handled by ▫ Returning an appropriate status code ▫ Returning an entity body explaining the error (when applicable) • Web API allows you to handle exceptions by ▫ Return an HttpResponseMessage with appropriate status code (404, 500 …) ▫ Throw an HttpResponseException ▫ Create a general exception handler by using Filters 43

HTTP defines a process to best match the server’s response to the client’s expectation  Negotiation can be done using:   Headers: Accept, Accept- Language, Accept- Charset, Accept-Encoding  URI: File extensions (.jpeg, .html), host-name: (com, org), path and query 44

ASP.NET, IIS & how to create virtual directory

SESSION OBJECTIVES • • • • • • ASP.NET Benefit How Does ASP.NET Work? IIS Creating a Virtual Directory Web Sharing the Project Folder Deleting a Web Project

HOW DOES ASP.NET WORK? • Requests an HTML file, the server returns the file • Requests an ASP.NET file, IIS passes the request to the ASP.NET engine on the server • The ASP.NET engine reads the file, line by line, and executes the scripts in the file • ASP.NET file is returned to the browser as plain HTML

 Separation of Code from HTML  Graphical Development Environment  Update files while the server is running!  Support for compiled languages  State management

IIS – Internet Information Services • Internet Information Service • IIS (Internet Information Services) is Microsoft's Internet server • IIS comes as a free component with Windows servers • IIS is also a part of Windows 2000 and XP Professional

    Start, Settings, Control Panel, Administrative Tools, Internet Services Manager Expand node for computer and default Web site Right-click Default Web site icon, select New, Virtual Directory In Virtual Directory Creation Wizard enter your project folder name as the alias and enter the folder and path

Web Sharing the Project Folder  Select the Project folder in My Computer  Right-click, select Properties, Web Sharing, activate Share This Folder  In Edit Alias dialog click OK

Deleting a Web Project  Project in IIS Virtual Directory  Delete the directory  Project in Web Shared Folder  “Unshare” it from Properties dialog  Either Reboot Computer or Stop and Restart IIS  Delete Folder

Thank You All

Add a comment

Related presentations

Related pages

PowerPoint Presentation On ASP.NET

PowerPoint Presentation On Computer Engineering | Biotechnology | MBA | Electronics And Communication Engineering | Entertainment | Electrical ...
Read more

Microsoft ASP.NET with Visual Studio.NET Presentation ...

PowerPoint presentation that covers Web forms, how to secure ASP.NET applications, caching, and monitoring ASP.NET applications. This version is the first ...
Read more

ASP.NET Presentations - Computer Science

Presentation Summary : Introduction to ASP.NET . Some references: Beginning ASP.NET using VB.NET; Wrox; 2002 chpt 2. Kalata, K, Introduction to ASP.NET ...
Read more

WF Scenarios Guidance: Presentation Flow

Presentation flow can be implemented in Windows Forms, Windows Presentation Foundation and even ASP.NET. ... ASP.NET presentation flow architecture.
Read more

The Presentation Layer

Design and Implementation Guidelines for Web Clients - November 2003 The Presentation Layer
Read more

ASP.NET Data Presentation Controls Essentials eBook by ...

Lesen Sie ASP.NET Data Presentation Controls Essentials von Joydip Kanjilal mit Kobo. This book takes you through the most important tasks for working with ...
Read more


Download ASP.NET MVC and learn how to build web apps using the model view controller pattern.
Read more