1. Web Programming Concepts using ASP.NET Adil Ahmed Mughal Namrah Arif 3rd April, 2010 NED University of Engineering and Technology
2.
3.
4.
5.
6.
7. HTTP GET Request HTML to be rendered by browser Web Browser (Client ) Web Site (Server)
8.
9.
10.
11.
12.
13.
14. GET http://www.abc.com HTML to be rendered by browser POST http://www.abc.com HTML to be rendered by browser Web Browser (Client ) Web Site (Server)
15.
16. HTTP GET Request HTML to be rendered by browser Web Browser (Client ) Web Site (Server) IIS (Web Server)
17.
18.
19.
20.
21. .NET Framework Overview .NET Class Libraries Operating System/Hardware Internet Information Services .NET Runtime (CLR) ASP.NET Data, LINQ, & XML System Communications & Workflow Windows Presentation Foundation Managed Application
34. THANK YOU! Adil Ahmed Mughal Namrah Arif 3rd April, 2010 Q & A
35.
Hinweis der Redaktion
Assalamoalikum and Good Afternoon! Thank you all for coming here today. I am excited to be here at one of the finest University of Pakistan and it’s my honor to talk with future engineers of World! Our topic of discussion today is “Web programming concepts using ASP.Net”. We have lot to cover and volunteers told us that people will rush for points around 3:30 PM, so let’s get started
Before beginning, let us quickly introduce us to you
The communication mechanism by which Web browsers talk to Web sites is named the Hyper- Text Transfer Protocol (HTTP). The World Wide Web as we know it today began as a research project at CERN in Switzerland. Lies on top of TCP/IP as an application layer
The earliest Web sites were built primarily using static HTML pages. That is, you could surf to some page somewhere and read the HTML document living there. While at that time being able to do this was pretty amazing, HTML eventually evolved to be capable of much more than simply formatting text. HTML includes the <form></form> opening and closing tags for notifying the browser that a section of HTML includes tags representing controls the user will interact with to eventually return information to the server. The contents of the form, which is to say the data contained in the input controls, will be “posted back” to the server for processing. It’s common to combine the words and call this action a postback . This is why the typical HTTP use case for an HTML document is GET, to initially retrieve the document, and then POST (or a modified form of GET), to return data to the server, if any.
http://localhost/SelectFeature2.htm?Feature=Versioning+purgatory&Lookup=Lookup This modifi ed URL, often called a query string , is then sent to the server. The form’s POST method causes the form contents to be sent to the server in the body of a returned HTTP packet, as you see here: POST /SelectFeature2.htm HTTP/1.1 Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, ... , */* Accept-Language: en-us Content-Type: application/x-www-form-urlencoded Accept-Encoding: gzip, deflate User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; ... .NET CLR 3.0.04506.30) Host: localhost:80 Content-Length: 42 Connection: Keep-Alive Cache-Control: no-cache Feature=Versioning+purgatory&Lookup=Lookup
When a request arrives, it’s the server’s job to somehow respond to the request in a meaningful way. On the Microsoft platform, IIS is the watchdog intercepting HTTP requests from port 80—the normal inbound port for HTTP requests. Internet servers use other ports as well. For example, HTTPS (Secure HTTP) happens over port 443. However, right now we’re mostly interested in normal Internet traffi c over port 80.
Let’s start off our discussion with a quick overview of the .NET framework. If you’re new to .NET its important for you to understand where ASP.NET “fits” into the overall framework. At its core the common language runtime (CLR) provides the execution environment for all .NET Framework code. Code that runs within the CLR is referred to as managed code. The CLR provides various functions and services required for program execution, including just-in-time (JIT) compilation, allocating and managing memory, enforcing type safety, exception handling, thread management, and security. IIS takes ASP.NET further by integrating the ASP.NET runtime extensibility model with the core server. This allows developers to fully extend the IIS server with the richness of ASP.NET and the .NET Framework, instead of using the lower level IIS C++ APIs. Existing ASP.NET applications also immediately benefit from tighter integration using existing ASP.NET features like Forms Authentication, Roles, and Output Caching for all content. Beyond these two powerful components are of course the .NET class libraries. Obviously there’s a lot to discuss in each of the chiclets but I wanted to provide you with an idea of how the libraries are categorized. System - Contains fundamental classes and base classes that define commonly used value and reference data types, events and event handlers, interfaces, attributes, and processing exceptions. Other classes provide services supporting data type conversion, method parameter manipulation, mathematics, remote and local program invocation, application environment management, and supervision of managed and unmanaged applications. Communications and Workflow (WCF & WF) – contain classes for encapsulation of intra-process communication and activity management Data, LINQ, and XML- are native components of the .NET framework we’ll see that foundational frameworks such as ADO.NET allow developers to abstract nuances of data source and concern themselves with application functionality. Windows Presentation Foundation (WPF) is a next-generation presentation system for building Windows client applications with visually stunning user experiences. With WPF, you can create a wide range of both standalone and browser-hosted applications using a subset of WPF called SilverLight Finally we have ASP.NET which is a unified Web development model that includes the services necessary for you to build enterprise-class Web applications with a minimum of coding. ASP.NET is part of the .NET Framework, and when coding ASP.NET applications you have access to classes in the .NET Framework. You can code your applications in any language compatible with the common language runtime (CLR),
When an ASP.NET page runs, the page goes through a life cycle in which it performs a series of processing steps. These include initialization, instantiating controls, restoring and maintaining state, running event handler code, and rendering. It is important for you to understand the page life cycle so that you can write code at the appropriate life-cycle stage for the effect you intend. Additionally, if you develop custom controls, you must be familiar with the page life cycle in order to correctly initialize controls, populate control properties with view-state data, and run any control behavior code. The processing steps listed here are a subset of the possible steps available during the lifetime of a request.