ASP.NET Presentation

  • 1,511 views
Uploaded on

This is asp.net ppt presentaion !!

This is asp.net ppt presentaion !!

More in: Education
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
    Be the first to like this
No Downloads

Views

Total Views
1,511
On Slideshare
0
From Embeds
0
Number of Embeds
2

Actions

Shares
Downloads
51
Comments
0
Likes
0

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide
  • Additionally supports constraints (type, min/max restriction, regex, and range), optional and default values, ordering, and extensibility.http://www.asp.net/web-api/overview/web-api-routing-and-actions/attribute-routing-in-web-api-2

Transcript

  • 1. 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
  • 2. 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.
  • 3. 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
  • 4. • 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
  • 5. 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.
  • 6.  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.
  • 7.  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
  • 8. • 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
  • 9.  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
  • 10. 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
  • 11. 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
  • 12. ASP.NET MVC Model View Controller (MVC) applications by using the ASP.NET framework
  • 13. 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
  • 14. 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
  • 15. 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
  • 16. 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
  • 17. 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>
  • 18. Friendly URLs MVC binds web paths to the logical URLs rather than to the physical files. Physical location: C:InetpubwwwrootWebSiteProducts.aspx ASP.NET style: http://www.website.com/Products.aspx?name=Me at MVC style: http://www.website.com/Products/Meat
  • 19. HOW DOES ASP.NET MVC LOOKS LIKE? ASP.NET MVC installs a new type of web project into VS2008.
  • 20. 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.
  • 21. 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.
  • 22.  http://www.asp.net/mvc - official site  http://weblogs.asp.net/scottgu/archive/2007/11/13/asp-net-mvcframework-part-1.aspx - development basics on ASP.NET MVC  http://weblogs.asp.net/scottgu/archive/2007/12/03/asp-net-mvcframework-part-2-url-routing.aspx - URL routing used in ASP.NET MVC  http://weblogs.asp.net/scottgu/archive/2007/12/06/asp-net-mvcframework-part-3-passing-viewdata-from-controllers-to-views.aspx interaction between Controllers and Views  http://weblogs.asp.net/scottgu/archive/2007/12/09/asp-net-mvcframework-part-4-handling-form-edit-and-post-scenarios.aspx - managing form input data
  • 23. ASP.NET Web API and HTTP Fundamentals
  • 24. 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
  • 25. 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
  • 26. NO REALLY, WHY? Today's systems face new challenges:  Broader reach of clients
  • 27. 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
  • 28. 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
  • 29. 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
  • 30. 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
  • 31. 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
  • 32. URIS • HTTP is not an RPC protocol • HTTP uses URIs to identify resources over the network • An HTTP URI has the following basic structure: http://theagency.com:8080/agents?id=1 Schema Host Port Absolute Path Query 34
  • 33. 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
  • 34. ASP.NET WEB API - ROUTING 36
  • 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) { ... } }
  • 36. 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
  • 37. 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
  • 38. 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)
  • 39. Status Code examples • • • • • • • • 41 404? 401? 304? 503? 500? 200? 301? 302?
  • 40.  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
  • 41. 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
  • 42. 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
  • 43. ASP.NET, IIS & how to create virtual directory
  • 44. SESSION OBJECTIVES • • • • • • ASP.NET Benefit How Does ASP.NET Work? IIS Creating a Virtual Directory Web Sharing the Project Folder Deleting a Web Project
  • 45. 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
  • 46.  Separation of Code from HTML  Graphical Development Environment  Update files while the server is running!  Support for compiled languages  State management
  • 47. 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
  • 48.     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
  • 49. 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
  • 50. 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
  • 51. Thank You All