You are on page 1of 9

ASP.

net Chap 1
Types of website created using ASP.net File-system websites Files stored in a local folder and when you run , the MS visual web developer starts asp.net web development server. Its the web server for the file system website. IIS not required for this type. Local internet information services (IIS) websites Visual web developer acts as IIS in the website. It creates the website in IIS root eg:\inetpub\wwwroot Visual web developer starts a browser to browse it and server name is localhost. IIS is the web server Remote internet information services (IIS) websites The same IIS website format is folled in a remote computer rather than a local one remote sites server name is used to browse FTP (File Transfer Protocol) websites ftp sites are file transfer sites , but they are usually run along with web servers to facilitate http access to files in the ftp server . the

server computer must have a browse location for the user to see the ftp sites web pages in a browser

Browse location: it is an http url that points to the files in the ftp site the url is different for ftp and web servers. So both the servers can be accessed simultaneously Website type: determines website file storage location and connection method Default event handling in web applications ASP.net being an OOPL supports object based events and methods. Various objects have various events which can be handled separately for various uses. Most of the objects in ASP.net are programmable using event based architecture. Every object in ASP.Net has various events associated to the same object and every object has a default event such as click event for a button object, text_changed event for a text object

Web configuration files In asp.net configuration files are distinctly maintained from the code and resource files in a project. Config data is stored in xml files for easy editing

Configuration hierarchy It is based on hierarchy of xml files.

It contains settings for any .NET framework application which includes ASP.Net web applications also Machine.Config file in the root of the hierarchy Global default settings for all application of the server Location: config folder in the .Net framework with version as folder name in the installation package

Web.config files: Controls the configuration of the web application. Location: config folder in the .Net framework with version as folder name in the installation package It contains default web server setting and some settings in web.config files override the machine.config files settings but other settings which control the .Net framework ( present in the machine config file ) cannot be overridden You can also create an web.config file in a root directory of each IIS website which provides website specific settings. Only the overridable attributes are to be mentioned in the custom web.config file created to the extent of the website alone. Folders in the website can also contain a web,.config file which controls the overridable settings to the extent of that particular foleder and files contained in it.

Merging configuration settings

At run time settings in the config hierarchy are merged as ASP.net builds a cache of setting for the specific application

Settings of machine.config file is retrieved Settings of default web.config file is added to those from machine.config to build effective config settings Asp.net determains if web.config exists for the website or virtual server then those are also added to the effective config settings already build From this I understand the lowest web level web config files overridable properties are taken to be added to the config file . the flow is from lower to higher level. Effective settings are used for all the server and the folder who dont have a web.config file.

Website administration tools


Asp.net config files can be edited using text editors , xml editor , a Microsoft management console snap-in , .net framework configuration API visual studios website administration tool visual studios website administration tool: helps you create config files easily for website level and folder level and application specific config file.

Chap 2 Event handling in web applications Default and non default events: The default event is an event which is applied by the .NET framework for a particular object Non default event For a non default event is an event which is implicitly chosed by the programmer for a particular purpose of the object

Event wireups Event wireup determines which procedures to call when an object raise an event AutoEventWireup is an attribute which is set to true It indicates .NET uses well defines signatures

Centralized event handlers It is an event handler to manage multiple events and use the same event handling methods for multiple objects Accessing webpage information Request.Browser object is used to access the web browser related properties such as Request.Browser.Browser to know the browser name and Request.Browser.version to know the version name etc

Page headers can be accessed using the Page object under the namespace System.Web.UI the properties can also be set at run time using C# coding like, Page.Header.Title property etc

Structured exception handling: It is the usual try catch concept of .NET framework and can be used in the same way as in desktop applications to handle web errors too Page level error handling It is used to trap all unhandled errors in page level which is better than try catch for a website application level error handling It is used to trap all unhandled errors in application level which is better than try catch for a web application Page level exceptions are handles by the page objects page_error event. The exception is to be written using Response.Write() method as the page_error event prevents web controls from rendering. The error information can be obtain from GetLastError method of the server object. Call Server.Clear() to clear the error information Application level error handling Method 1 Create Application_Error method in global asax file for an asax file and you can write code to handle all uhandled errors Method 2

Include a <customErrors> element in web.config file and include defaultRedirect attribute to redirect to a specific page when ever an unhandled error occurs. Specific redirect attribute to specific http errors such as 404 (page not found), 501 ( server not accessible or gateway error) etc

Chap 3
Adding and configuring server controls HTML controls Html controls are controls which are available in html language ., they are html markup elements . can be edited using properties window and code. To enable a html control to be displayed and work in a asp.net web server page , in the source code add the attribute runat=server in the markup for the control Web server controls Web server controls are controls from asp.net which are converted in to html controls at run time . the output is dynamically generated based of web server controls definition For running server side associated coded controls web server control suits well , such as derived the data from the database and presenting it in text box is possible only in web server control and not in html input text Various controls adding them manipulating them in both design time and runtime is discussed in detail. Postback model It enables sending control properties from web pages to web server and restoring the value when a response is sent back.

Round-Trip Processing It enables web server controls to retain the values over multiple request to the server even though the HTTP machanisms are stateless the asp.net post back model enables you to develop application with sateful facility by posting information from browser to server where server events to be raised

AutoPostBack property This property controls whether the interaction with control should raise a RoundTrip request to server such as change of selection in a drop down list then the AutoPostBack property should be set to true EnableViewState property It determines whether the control should retain state for the duration of postback . this property should be set to true for controls whose properties are set in server side code. Cross page postbacks It is used in transferring the response of postback from one page to any other page in the web server. Through the property PostbackUrl property of the control

Chap 4