Issuu on Google+

1


2


3


1. Author writes HTML. 2. The Web browser sends a request for a particular Web page of a Web site to the Web server hosting that site. 3. The Web server searches for the page in directory containing Web pages for the Web site. 4. On finding the requested page, the Web server collects the HTML of the Web page. 5. The Web server sends the HTML to the requesting browser which then parses it to develop the visual presentation of the page.

4


5


1. The Web browser sends a request for a particular Web page of a Web site to the Web server hosting that site. 2. The Web server searches for the page in directory containing Web pages for the Web site.

3. On finding the requested page, the Web server collects the content (code + HTML) of the Web page. 4. The Web server then parses the content to produce HTML. 5. The HTML stream is sent back to the requesting browser which then parses it to develop the visual presentation of the page.

6


7


ASP is a COM (Component Object Model) based technology. The ASP component (asp.dll) attaches itself with the IIS (Internet Information Server). Upon receiving a request for an ASP page (.asp), IIS redirects it to the asp.dll. The asp.dll parses the ASP page for any script within it and if found, combines it with the HTML code and returns it to IIS which then forwards it to the requesting browser.

8


9


10


11


12


13


14


15


16


17


18


Notes: Page.Request: It receives the HttpRequest object for the requested page. HttpRequest object has information about the current HTTP request.

Page.response: It receives the HttpResponse object associated with the Page object. Through this object, you can send HTTP response data to a client. It has information about that response. Page.IsPostBack: It returns a a value indicating if the page is being loaded for the first time or whether it is being loaded in response to a client postback UICulture: This is the User Interface culture and is a property of the executing thread

19


Notes: Control.UniqueID: Gets the unique, hierarchically qualified identifier for the server control. BaseValidator.Validate: Performs validation on the associated input control and updates the Is Valid property. IValidator.IsValid Property: When implemented by a class, gets or sets a value indicating whether the user-entered content in the specified control passes validation.

20


Notes: Control.Render Method sends server control content to a provided HtmlTextWriter object, which writes the content to be rendered on the client. HttpResponse.OutputStream Property: Enables binary output to the outgoing HTTP content body.

21


Notes: ASP.NET Page life cycle events are as follows: PreInit: This event is used to check whether the page being processed is being requested for the first time, using IsPostBack property Init: This event is used to read or initialize the control properties. InitComplete: This event is raised by the Page object. This event is used to complete all tasks that require initialization PreLoad: This event is used to perform any processing on the page or control before the load event occurs Load: In this event, the Page calls the OnLoad event method on the Page, and then does the same for each child control, till the page and all controls are loaded Control events: These events are used to handle specific control events such as click event of the Button, or Text Changes event for the TextBox control LoadComplete: This event is used to complete the tasks that require all other controls on the page be loaded PreRender: The Page object calls EnsureChildControls for each control and for the page. SaveStateComplete In this event any changes to the page or controls will be ignored, as the ViewState for the page and the controls has been already saved Render: This is not an event . At this stage of the lifecycle of the page, the page calls all this method on each control. Unload: This event occurs for each control and then for the page. This event can also be used to close control-specific database connections. Note: The page life cycle events described here and in the subsequent slides have been referred from: http://msdn2.microsoft.com/en-us/library/ms178472.aspx

22


Notes: Init: Server controls should perform any initialization steps that are required to create and set up an instance. You cannot use view-state information within this event; it is not populated yet. You should not access another server control during this event, regardless of whether it is a child or parent to this control. Other server controls are not certain to be created and ready for access.

23


Notes ViewState: Web Forms pages provide the ViewState property as a built-in structure for automatically retaining values between multiple requests for the same page. This will be dealt with in detail in a later presentation (4.5 State Management).

24


25


Control.EnsureChildControls Method: It determines whether the server control contains child controls. If it does not, it creates child controls. DataSourcID:

Gets or sets the ID of the control from which the data-bound control retrieves its list of data items. Control.DataBind Method: Binds a data source to the invoked server control and all its child controls.

26


27


28


Review the points on the slide, and provide the following elaboration to each point: Easy Programming Model: HTML-like style of declarative programming of Server controls lets you build great pages with very less code than with classic ASP. All Web browsers support ASP.NET page -- including Netscape, Opera, AOL, and Internet Explorer Flexible Language Options: More than 25 .NET languages are supported by ASP.NET. This gives flexibility in choice of language Rich Class Framework: Over 4500 classes and more that encapsulate rich functionality like XML, data access, file uploading, regular expressions, image generation, performance monitoring and logging, transactions, message queuing, SMTP mail are available in .NET Framework Compiled Execution: ASP.NET application is up to date due to dynamic compilation, and this compiled execution makes the application fast Rich Output Caching: Rendering of controls to XHTML is improved by output caching. Database caching enables the application to be notified when the underlying database changes, eliminating unnecessary queries Web-Farm Session State: In a Web farm, ASP.NET session state lets you share session data and user-specific state values across all machines. A Web Farm comprises of multiple Web servers situated on different machines having the same Web Application running on them. It is used for scaling up to increasing number of users and provide satisfactory response times. Enhanced Reliability: Master Pages - Using Master Pages, ASP.NET makes it easy to create and apply a common look-and-feel to your Web site. It ensures that the application is always available to users by automatically detecting and recovering from errors like deadlocks and memory leaks. Themes: Using Themes, Web pages can be given a consistent appearance with the built-in support. XHTML ComplianceUsing ASP.NET, XHTML-compliant pages can be easily created. Improved Security ASP.NET helps you protect your data and users. Built-in Protection ASP.NET has built-in protection from many common forms of hacker attacks, including cross-site scripting and more. XML Web Services: ASP.NET makes exposing and calling XML Web Services simple. XML Web services allow applications to share data and communicate with other application over the Internet, irrespective of the type of operating system or programming language. Improved Performance and Scalability: ASP.NET lets you use serve more users with the same hardware.

29


Web Server : Is a computer connected to the Internet or an intranet, based on where the web application resides and the purpose of the application. When a URL is typed in the address bar of the browser, the browser sends a request to the server which then fetches the required page and sends it to your browser. Example: http://myservername/myApp/Default.aspx When the above URL is typed in a browser, the browser sends a request to the server in this case “myservername”, which then fetches the required page “Default.aspx” from the web application “myapp” and then sends it to the browser.

30


The main content folder of IIS is Inetpub directory. The content directories for each service are installed under this directory. All the other services of IIS depend on the IIS Admin Service. Service. If this service is stopped, all other IIS services also stop

31


32


33


IIS MMC can be opened also by: Start ->Run -> inetmgr -> OK

34


35


To confirm that the application was created, right-click the new virtual directory, and then click Properties. On the Virtual Directory tab, ensure that the virtual directory name is listed in the Application Name box under Application Settings.

If it is not, click Create. The application name need not match the virtual directory alias.

36


37


38


39


40


41


42


Reference

43


44


Introduction to ASP.NET and ASP.NET Web Forms