15
2 ASP.Net 2.0 INTRODUCTION ASP.NET 2.0 allows you to create customizable data-driven Web applications by providing controls, such as DataSource and Login. It also provides various security related controls, such as the Login and LoginName controls to enhance the security of a Web application. This ReferencePoint introduces the new features and enhancements provided by ASP.NET 2.0. It explains how to use ASP.NET 2.0 to deploy and manage Web applications. 2.1 OBJECTIVES OF THE UNIT • Introduction to ASP.NET Features of the new technology • The basic difference between ASP and ASP.NET • The new paradigm model • The key elements that comprise the .NET framework • The key design goals and technology of ASP.NET 2.2 DEFINITION OF ASP.NET ASP.NET is the latest incarnation of Microsoft’s Active Server Pages (ASPs) and is the engine that executes ASP.NET web pages. An ASP.NET web page is the pro- gram that you create to generate a dynamic web page. It helps in creating dynamic web pages that responds to the requests made by the visitors to your site, such as to display their account status and to process an order. 2.3 FEATURES OF ASP.NET 2.0 Some new features of ASP.NET 2.0 are: (a) Master pages, themes, and skins: Enable you to customize the appearance of a Website.

2.0 INTRODUCTION 2.1 OBJECTIVES OF THE UNIT …...2 ASP.Net 2.0 INTRODUCTION ASP.NET 2.0 allows you to create customizable data-driven Web applications by providing controls, such

  • Upload
    others

  • View
    5

  • Download
    0

Embed Size (px)

Citation preview

Page 1: 2.0 INTRODUCTION 2.1 OBJECTIVES OF THE UNIT …...2 ASP.Net 2.0 INTRODUCTION ASP.NET 2.0 allows you to create customizable data-driven Web applications by providing controls, such

2 ASP.Net

2.0 INTRODUCTION

ASP.NET 2.0 allows you to create customizable data-driven Web applications by providing controls, such as DataSource and Login. It also provides various security related controls, such as the Login and LoginName controls to enhance the security of a Web application.

This ReferencePoint introduces the new features and enhancements provided by ASP.NET 2.0. It explains how to use ASP.NET 2.0 to deploy and manage Web applications.

2.1 OBJECTIVES OF THE UNIT

• Introduction to ASP.NET

• Features of the new technology

• The basic difference between ASP and ASP.NET

• The new paradigm model

• The key elements that comprise the .NET framework

• The key design goals and technology of ASP.NET

2.2 DEFINITION OF ASP.NET

ASP.NET is the latest incarnation of Microsoft’s Active Server Pages (ASPs) and is the engine that executes ASP.NET web pages. An ASP.NET web page is the pro-gram that you create to generate a dynamic web page. It helps in creating dynamic web pages that responds to the requests made by the visitors to your site, such as to display their account status and to process an order.

2.3 FEATURES OF ASP.NET 2.0

Some new features of ASP.NET 2.0 are:

(a) Master pages, themes, and skins: Enable you to customize the appearance of a Website.

Page 2: 2.0 INTRODUCTION 2.1 OBJECTIVES OF THE UNIT …...2 ASP.Net 2.0 INTRODUCTION ASP.NET 2.0 allows you to create customizable data-driven Web applications by providing controls, such

ASP .Net 25

• CreateUserWizard: Helps create a registration page through which an end -user can enter registration information in a database. The syntax generated when you add a CreateUserWizard control to a Web page is:

<asp:CreateUserWizard ID=”CreateUserWizard1” Runat=”server” />

• LoginStatus: Provides automatic links to the Web pages, through which an end-user can log on or log out of a Web application. The syntax generated when you add a LoginStatus control to a Web page is:

<asp:LoginStatus ID=”LoginStatus1” Runat=”server” />

• LoginName: Displays the name of the end-user logged on to a Web application. The syntax generated when you add a LoginName control to a Web page is:

<asp:LoginName ID=”LoginName1” Runat=”server” />

• LoginView: Displays the content of a Web application, depending on the role of an end-user. End-users can access only those parts of the Web application that the Web site administrator assigns to them. The syntax generated when you add a LoginView control to a Web page is:

<asp:LoginView ID=”LoginView1” Runat=”server”>

• PasswordRecovery: Helps an end-user to retrieve a lost password. The syntax generated when you add a PasswordRecovery control to a Web page is:

<asp:PasswordRecovery ID=” PasswordRecovery1” Runat=”server”>

• ChangePassword: Enables an end-user to change a password. The syntax generated when you add a ChangePassword control to a Web page is:

<asp:ChangePassword ID=” ChangePassword1” Runat=”server”>

2.7 PROVIDER MODEL

The provider model of ASP.NET 2.0 provides the infrastructure to implement security in an ASP.NET Web application. The provider model contains two distinct security providers:

(a) Membership Provider: Helps store end-user information, such as login names and passwords.

(b) Role Provider: Helps store end-user roles.

ASP.NET 2.0 contains two membership providers, AccessMembershipProvider and SqlMembershipProvider. AccessMembershipProvider is the default membership provider that stores the login names and passwords in a Microsoft Access database. The Microsoft Access database is automatically created when you create a new Web application. SQLMembershipProvider helps store the login names and passwords in a Microsoft SQL Server database. You need to modify the default Membership Provider for the Web application in the Web.config file to use SqlMembershipProvider, as shown in the following syntax:<configuration>

Page 3: 2.0 INTRODUCTION 2.1 OBJECTIVES OF THE UNIT …...2 ASP.Net 2.0 INTRODUCTION ASP.NET 2.0 allows you to create customizable data-driven Web applications by providing controls, such

ASP .Net 27

• CatalogZone: Helps an end-user to add a WebPart to the Web page through templated con-trols. The CatalogZone control provides two types of templated controls to generate a list of available WebParts in a Web page:

(a) PageCatalogPart: Generates a list of WebPart controls for a Web page which were earlier removed by an end -user.

(b) TemplateCatalogPart: Generates a list of new WebParts for a Web page which were not included by an end -user.

• EditorZone: Helps an end-user change the layout of the WebPart controls. The EditorZone control provides three editing controls to change the appearance of a WebPart control:

(a) AppearanceEditorPart: Helps change the appearance of a WebPart control.

(b) LayoutEditorPart: Helps change the layout of a WebPart control.

(c) BehaviourEditorPart: Helps change the behavior of a WebPart control.

2.9 PERSONALIZATION FRAMEWORK

The personalization framework of ASP.NET 2.0 helps identify and register end-users and store end -user information using various functions and controls. The Web application uses the stored profile of the end-users to display the content according to the requirement of the end- users. For example, an end-user customizes a part of a Web application according to personal requirements. The person-alization framework stores the setting of the Web application and displays the same content when the end-user visits the Web site again. The Web application should perform the following tasks to personalize a Web application:

Identify the end-user logging on to a Web application. The Web application should be able to differentiate the requests of one end-user from another.

Provide a personalized experience. This includes allowing or disallowing various actions to the end user. For example, a particular end user can view an annual report, customize a Web page, or keep track of other end user information.

Store end user information. The Web application needs to store end user information between the Web page requests or between sessions. The end user information can include the identity of an end user, such as login and password.

You need to configure the personalization properties of the end users so that a Web application can perform the various tasks.

Note: Personalization properties are defined in the <personalization /> section of the Web.config file present in the root directory of the Web application.

2.10 ENHANCED CODE-BEHIND MODEL

The code-behind model helps separate the user interface and the logic of a Web application into separate files. The two files that the code-behind model of ASP.NET 2.0 uses to separate a Web page are:

• Content file: Contains the presentation content, such as Web forms of the Web application. Content files store information about the user interface and are saved as .aspx.

• Code-behind file: Contains logic of the Web application to perform some action. Code-behind files are saved as .aspx.vb.

Page 4: 2.0 INTRODUCTION 2.1 OBJECTIVES OF THE UNIT …...2 ASP.Net 2.0 INTRODUCTION ASP.NET 2.0 allows you to create customizable data-driven Web applications by providing controls, such

28 Dot Net Technology

The separation of Web application files helps manage and debug the code of the Web application.

Figure 2.1 shows the code-behind model for ASP.NET 2.0:

Fig. 2.1 The Code-Behind Model.

This figure shows the execution of the code-behind file and content file of ASP.NET 2.0.

In ASP.NET 2.0, when a .aspx Web page with a code-behind file is requested, the .aspx and the code-behind files are combined into a single class at run time rather than two separate classes. You do not need to compile a code-behind file separately because it is automatically compiled when the end user requests a Web page. In the earlier version of ASP .NET, the code-behind files and any other supporting classes are compiled into MSIL. The compiled code is first stored in a file called assembly, and then the individual .aspx files are compiled at run time. ASP.NET 2.0 provides the following compilation options depending on your specific needs:

• Normal compilation: Compiles the code-behind files and .aspx pages separately.

• Batch compilation: Enables you to compile an ASP.NET Web application when you request a single Web page of a Web application.

Page 5: 2.0 INTRODUCTION 2.1 OBJECTIVES OF THE UNIT …...2 ASP.Net 2.0 INTRODUCTION ASP.NET 2.0 allows you to create customizable data-driven Web applications by providing controls, such

ASP .Net 29

• Deployment pre-compilation: Provides a new compilation method, which allows compila-tion of all the code-behind files, .aspx pages, and HTML and graphic resources of a Web application prior to deployment of the Web application on the Web server. You cannot make any changes to the Web application after deploying it on the Web server.

• Full-run time compilation: Compiles the Web application at run time. You can use the full-run time compilation feature to modify the Web application after its deployment.

2.11 MOBILITY SUPPORT

ASP.NET 2.0 allows you to create Web pages that generate output in different mobile devices, such as mobile phones and Personal Digital Assistants (PDAs). ASP.NET 2.0 introduces several mobile controls that are compatible with a wide variety of mobile devices. The mobility support of ASP.NET 2.0 helps create a common Web page that can be requested by browsers, mobile phones, or PDAs. For example, a Calendar control can generate output in different formats, such as HTML and WML depending on the devices the end users are using to request the Web page.

ASP.NET 2.0 introduces two mobile controls:

(a) ContentPager: Allows you to divide a Web page into separate sections that display Web page content in mobile devices.

(b) PhoneLink: Provides a link to the phone number when a phone call is initiated from a mobile phone. The PhoneLink control has a property called PhoneNumber, which specifies the phone number to be linked.

In addition to these two mobile controls, ASP.NET provides an attribute called SoftKeyLabel. You can integrate this attribute with the ASP.NET mobile controls to link a soft key button to a mobile control that performs associated action. For example, when you press the dial soft key button on a mobile phone, a specified phone number is linked and a call is initiated.

Note: Soft key buttons are the buttons that you use to operate a mobile phone.

2.12 NEW CONTROLS IN ASP.NET 2.0

ASP.NET 2.0 introduces several new controls that help create data-driven Web applications. These controls help perform actions, such as connecting to a database without writing any code. Some of the new controls are:

• Form and page based controls: Allow you to create a User Interface (UI) in a Web page.

• Navigation controls: Allow you to build menus and Web site navigation UI in a Web appli-cation that enables the end-users to navigate between the Web pages.

• Validation group property: Enables you to create different groups of validation controls that are assigned to the Web form controls, such as text boxes.

• Data Source controls: Enable you to connect a Web application to the database created in vari-ous data sources, such as SQL server database. It includes the AccessDataSource, SqlDataSource, XmlDataSource, ObjectDataSource, DataSetDataSource, and SiteMapDataSource controls.

• New data-bound controls: Bind data to a data source automatically. Data-bound controls include the GridView, DetailsView, and FormView controls.

Page 6: 2.0 INTRODUCTION 2.1 OBJECTIVES OF THE UNIT …...2 ASP.Net 2.0 INTRODUCTION ASP.NET 2.0 allows you to create customizable data-driven Web applications by providing controls, such

30 Dot Net Technology

2.13 FORM AND PAGE-BASED CONTROLS

ASP.NET 2.0 introduces the form and page-based controls, such as the BulletedList control, which helps you to create a UI for a Web application. Some form and page-based controls are:

• BulletedList: Creates bulleted lists, such as unordered and ordered lists. The BulletedList control contains properties, such as BulletStyle, which allows you to specify the bullet type.

• FileUpload: Uploads various files, such as text files, to the Web server. The FileUpload control contains properties, such as AlternateText that provide the reference and information about the uploaded file.

• HiddenField: Stores hidden values in a Web page. The hidden values are not displayed to the end-user.

• Table: Displays the content of a Web page in browsers and mobile devices. The Table control automatically provides three views of the data in a table depending on the Web browser and mobile devices. For Web browsers, the Table control generates the output in tabular form. For mobile devices, it displays a summary view of the data. When an end-user clicks the summary view of the data, it displays a page containing the information about the data.

• DynamicImage: Generates a suitable format of an image, such as .gif, .jpg, and .bmp. The DynamicImage control allows you to display an image in different browsers because all the browsers do not provide support for all image formats.

• ImageGenerator: Allows you to create images dynamically in a Web page.

• MultiView and View. Allow you to create several screens in a Web page. Each screen is a separate section of the UI that can be inserted into the Web page at run time. The MultiView control acts as a container in which you can place one or more View controls. The View controls can contain various other controls, such as label and text box controls.

2.14 NAVIGATION CONTROLS

ASP.NET 2.0 provides various Navigation controls, such as the ImageMap control, which enable you to build menus and other site navigation user interfaces. The new Navigation controls of ASP.NET 2.0 are:

• ImageMap: Allows you to define different regions of an image. When an end-user clicks a particular region of the image, an event is raised and a specified action is performed. For example, you can define regions, north, south, east, and west on the image of the world map. You can display the name of the countries in those sections when the end-user clicks a specific region.

• SiteMapPath: Displays the hierarchical path of the Web pages of a Web application on the current Web page of an end-user. The SiteMapPath control allows you to navigate between the Web pages.

2.15 VALIDATION GROUPS

ASP.NET 2.0 provides a feature, which enables you to create different groups of validation controls assigned to the Web form controls, such as text boxes. These groups are called validation groups. Validation controls are ASP.NET controls that you assign to input controls, such as text boxes,

Page 7: 2.0 INTRODUCTION 2.1 OBJECTIVES OF THE UNIT …...2 ASP.Net 2.0 INTRODUCTION ASP.NET 2.0 allows you to create customizable data-driven Web applications by providing controls, such

ASP .Net 31

password fields, radio buttons, and check boxes. The validation controls help validate the data entered by an end-user to input controls. You can assign a validation group to a collection of input controls if you want to validate the collection of input controls on the same criterion. You can assign the Button control to a group of input controls to validate the data entered to each group of input controls on a criterion. The Validation group property is useful when multiple forms are required in a single Web page. For example, you can create a Web page that contains login and password text boxes for registered end-users, and another set of controls for new end-users to register with the Web site. In this case, you can use the validation group property to perform different actions, such as logging on to the Web site and registering an end-user. The following example shows how to use the validation groups with Web form controls:

Example: Using Validation Groups

<%@ Page Language=”vb” %>

<script runat=”server”>

//Specify the code to be executed when you click the //button associated with

Validation Group1

Sub Group1Click(ByVal s As Object, ByVal e As EventArgs)

If Page.IsValid Then

//Display a message when you click a button associated with Validation //Group1

is

lblResult.Text = “Group 1 Submitted”

End If

End Sub

//Specify the code to be executed when you click the //button associated with

Validation Group2

Sub Group2Click(ByVal s As Object, ByVal e As EventArgs)

If Page.IsValid Then

//Display a message when you click a button associated with Validation Group2

lblResult.Text = “Group 2 Submitted”

End If

End Sub

</script>

<html> <head runat=”server”>

<title>Validation Groups

</title>

</head>

<body>

<form runat=”server”>

<asp:Label ID=”lblResult” Runat=”Server” />

<fieldset style=”padding:20px”> <legend>Group 1</legend>

//Grouping a textbox control, a button and a //validation control in the Validation

Group1

<asp:TextBox id=”TextBox1” Runat=”Server” />

<asp:Button ValidationGroup=”Group1” Text=”Submit” OnClick=”Group1Click” Runat=”Server”

/>

Page 8: 2.0 INTRODUCTION 2.1 OBJECTIVES OF THE UNIT …...2 ASP.Net 2.0 INTRODUCTION ASP.NET 2.0 allows you to create customizable data-driven Web applications by providing controls, such

32 Dot Net Technology

<asp:RequiredFieldValidator ValidationGroup=”Group1” ControlToValidate=”TextBox1”

Text=”(required)” Runat=”Server” /> </fieldset>

<fieldset style=”padding:20px”> <legend>Group 2</legend>

//Grouping a textbox control, a button and a //validation control in the Validation

Group2

<asp:TextBox id=”TextBox2” Runat=”Server” /> <asp:Button ValidationGroup=”Group2”

Text=”Submit” OnClick=”Group2Click” Runat=”Server” /> <asp:RequiredFieldValidator

ValidationGroup=”Group2” ControlToValidate=”TextBox2” Text=”(required)” Runat=”Server”

/>

</fieldset> </form> </body> </html>

In the above listing, a Web page is displayed containing two text box controls. Each text box control is associated with a RequiredFieldValidator control, which checks whether the text boxes are empty. Each text box control and RequiredFieldValidator control are assigned to two different validation groups, Group1 and Group2. Each validation group is associated with a Button control. An end-user can click the Button control to perform different actions specified in the group.

2.16 DATASOURCE CONTROLS

ASP.NET 2.0 introduces various DataSource controls, such as AccessDataSource, which enables you to connect a Web application to the database stored in different data sources. You can retrieve and manipulate the data using the DataSource controls. The various types of DataSource controls are:

• AccessDataSource: Enables you to connect to a Microsoft Access database. You can insert, update, and delete data stored in an Access database using this control.

• SqlDataSource: Enables you to access a Microsoft SQL server database.

• XmlDataSource: Enables you to access data stored in an XML data source.

• ObjectDataSource: Allows you to interact with a data access layer that consists of various classes to access data. The data access layer of a Web application allows you to retrieve and manipulate the data in a database. The ObjectDataSource control allows you to create three-tiered or n-tiered Web applications.

• DataSetDataSource: Allows you to access XML data, which is in tabular form. The DatSetDataSource control can be linked to the controls, such as the DataGrid control that displays data in tabular form.

• SiteMapDataSource: Enables you to change the physical location of the Web application files without affecting the navigation of the Web pages.

2.17 DATA-BOUND CONTROLS

ASP.NET 2.0 introduces new data-bound controls that bind data automatically. These controls ensure that any cached data of a database, stored in a Web page is automatically refreshed when the database is updated. Some data-bound controls introduced in ASP.NET 2.0 are:

• GridView: Enables you to display multiple records in a Web page. The GridView control is similar to a DataGrid control provided by ASP.NET 1.x, except that the GridView control also enables you to perform tasks, such as paging, sorting, and filtering data in a Web page without writing the code.

Page 9: 2.0 INTRODUCTION 2.1 OBJECTIVES OF THE UNIT …...2 ASP.Net 2.0 INTRODUCTION ASP.NET 2.0 allows you to create customizable data-driven Web applications by providing controls, such

ASP .Net 33

• DetailsView: Enables you to display only one record at a time. The DetailsView control can be linked to a GridView control that enables you to update, delete, and add a new record in a database.

• FormView: Provides a UI to display and modify the data stored in a database. The FormView control provides different templates, such as ItemTemplate and EditItemTemplate that you can use to view and modify the database records.

2.18 CACHING IN ASP.NET 2.0

Caching is defined as temporary storage of data for fast retrieval on subsequent requests. In ASP.NET 2.0, the caching support is integrated with the DataSource controls to cache data in a Web page. ASP.NET 2.0 introduces a new control, called Substitution control, which allows you to link dynamic and cached content in a Web page.

2.19 CACHING WITH THE DATASOURCE CONTROLS

The DataSource controls enable you to cache database data and connect a .NET application to a database. The DataSource control provides various properties, such as EnableCaching, which you can use to automatically cache the data represented by a DataSource control. The syntax to cache a database table in a memory for 20 minutes is:

<asp:SqlDataSource ID=”SqlDataSource1” EnableCaching=”true” CacheDuration=”1200” Co

nnectionString=”Server=localhost;database=XYZ” SelectCommand=”SELECT FirstName FROM

Employee” Runat=”server” />

The above syntax caches a database table, Employee. The EnableCaching property of the DataSource control has the value, True. The CacheDuration property of the DataSource control specifies the time, in seconds, for caching the data before it is updated in a database containing the Employee table. The value of the Time parameter is set to 1200 to cache data for 20 minutes.

2.20 USING SQL CACHE INVALIDATION

ASP.NET 2.0 introduces the SQL Cache Invalidation feature, which you can use to automatically update cached data whenever the data in a database changes. SQL Cache Invalidation works by constantly monitoring a database to check for changes. The ASP.NET 2.0 framework checks for any updates in the database. If the ASP.NET framework detects any changes in the database, the database items added to the cache are invalidated.

Note: SQL Cache Invalidation only works with Microsoft SQL Server version 7 and later. The other databases, such as Microsoft Access or Oracle do not support this feature.

You can use SQL Cache Invalidation in the following three scenarios:

• Working with page output caching: Enables you to cache the entire content of a Web page.

• Working with the DataSource controls: Enables you to cache database data. It is useful in cases where you need to work with the same database data in multiple Web pages.

• Working with page data caching: Enables you to cache data of a Web page.

2.21 USING SUBSTITUTION CONTROL

ASP.NET 2.0 provides a new control, called the Substitution control, which enables you to insert dynamic content into a cached Web page. For example, you can display the name of an end-user,

Page 10: 2.0 INTRODUCTION 2.1 OBJECTIVES OF THE UNIT …...2 ASP.Net 2.0 INTRODUCTION ASP.NET 2.0 allows you to create customizable data-driven Web applications by providing controls, such

ASP .Net 35

Fig. 2.3 The Document Window of the FirstPage.aspx File.

This figure shows the document window of the FirstPage.aspx file, which you can edit to build the first ASP.NET Web page, in Design view.

To add controls to the document window of the FirstPage.aspx file:

1. Drag a Label control and a Button control from the toolbox, as shown in Fig. 2.4

Fig. 2.4 Editing the Document Window of the FirstPage.aspx File.

Page 11: 2.0 INTRODUCTION 2.1 OBJECTIVES OF THE UNIT …...2 ASP.Net 2.0 INTRODUCTION ASP.NET 2.0 allows you to create customizable data-driven Web applications by providing controls, such

ASP .Net 37

Continue List

7. Select File Æ Save to save the FirstPage.aspx file.

2.23 RUNNING AN ASP.NET 2.0 WEB PAGE IN THE IIS WEB SERVER

You need to build the FirstPage.aspx Web page before you can run it in the Web browser. To build and run an ASP.NET Web page:

1. Select Build Æ Build Page to compile the Web page.

2. Select Debug Æ Start to run the Web page.

The Web browser displays the Web page if there is no error in the Web page. Figure 2.5 shows the Web page displayed in the Web browser:

Fig. 2.5 Displaying the FirstPage.aspx Web Page.

This figure shows the message, Welcome to ASP.NET 2.0, which is displayed before you click the Submit button.

Figure 2.6 shows the message displayed when you click the Submit button.

This figure shows the message, This is the First Page, which is displayed in the Web browser when you click the Submit button.

Note: You can also press the F5 button to run the Web page.

2.24 DEPLOYING ASP.NET 2.0 WEB APPLICATIONS

ASP.NET 2.0 provides enhanced mechanisms to deploy Web applications. You can deploy an ASP.NET 2.0 Web application at various stages of its life cycle, such as development and production.

Page 12: 2.0 INTRODUCTION 2.1 OBJECTIVES OF THE UNIT …...2 ASP.Net 2.0 INTRODUCTION ASP.NET 2.0 allows you to create customizable data-driven Web applications by providing controls, such

38 Dot Net Technology

Fig. 2.6 Displaying a Message on the Click Event of the Submit Button.

2.24.1 Deploying at Development

ASP.NET 2.0 provides a built-in Web server for the development of ASP.NET 2.0 Web applications. This Web server allows you to test the Web applications locally during its development. The built-in Web server provides debugging support without incurring any additional administrative maintenance for the Web application. This feature removes the use of IIS on the computer when developing the Web application. After development of a Web application, you need to deploy it on the IIS to make the application available on a network.

2.24.2 Deploying at Production

After developing an ASP.NET 2.0 Web application, you need to deploy it on the server with IIS 5.0 version or later installed. To deploy ASP.NET 2.0 Web applications, you need to deploy .NET Framework 2.0 on the server. You can deploy .NET Framework 2.0 without uninstalling or modi-fying any Web application that uses version 1.x of the .NET Framework. ASP.NET 2.0 provides the Microsoft Management Console (MMC) snap-in for IIS that allows you to decide which Web applications should use which versions of the .NET Framework. To configure the versions of ASP.NET using the MMC snap-in:

1. Select Start Æ Settings Æ Control Panel to open the Control Panel window.

2. Select Administrative Tools to open the Administrative Tools window.

3. Select Computer Management to open the Computer Management window, as shown inFig. 4.7.

Page 13: 2.0 INTRODUCTION 2.1 OBJECTIVES OF THE UNIT …...2 ASP.Net 2.0 INTRODUCTION ASP.NET 2.0 allows you to create customizable data-driven Web applications by providing controls, such

ASP .Net 39

Fig. 2.7 The Computer Management Window.

This figure shows the Computer Management window that lists System tools, Storage, and Services and Applications.

Select Services and Applications Æ Internet Information Services Æ Web Sites Æ Default Web Site, and right-click Default Web Site to open the Default Web Site Properties dialog box, as shown in Fig. 2.8.

Fig. 2.8 The Default Web Site Properties Dialog Box.

Page 14: 2.0 INTRODUCTION 2.1 OBJECTIVES OF THE UNIT …...2 ASP.Net 2.0 INTRODUCTION ASP.NET 2.0 allows you to create customizable data-driven Web applications by providing controls, such

40 Dot Net Technology

This figure shows the Default Web Site Properties dialog box for selecting different versions of ASP .NET.

5. Click ASP.NET to display the ASP.NET tab of the Default Web Site Properties dialog box.

6. Select the ASP.NET version option from the ASP.NET version dialog box to configure the ASP.NET version, which the Web application will use.

7. Click the Edit configuration button to open the ASP.NET Configuration Settings dialog box, as shown in Fig. 2.9.

Fig. 2.9: The ASP.NET Configuration Settings Dialog Box.

This figure shows the ASP.NET Configuration Settings dialog box, where you can edit various settings of the Web application, such as enabling session state and setting page language, without manipulating the Web.config file.

8. Click OK after editing various settings of the Web application to close the ASP.NET Configuration Settings dialog box.

9. Click Apply in the Default Web Site Properties dialog box to apply the above settings to the Web application.

10. Click OK to close the Default Web Site Properties dialog box.

2.25 DEPLOYING WEB APPLICATIONS

You need to deploy the Web application on the Web server after creating the application. Deploying the Web application makes it available on the network so that end-users can access it. The two methods, which you can use to deploy the ASP.NET Web applications, are:

Page 15: 2.0 INTRODUCTION 2.1 OBJECTIVES OF THE UNIT …...2 ASP.Net 2.0 INTRODUCTION ASP.NET 2.0 allows you to create customizable data-driven Web applications by providing controls, such

42 Dot Net Technology

Fig. 2.10 The Web Site Administration Tool Window.

2.28 MANAGING END-USERS

The Web Site Administration Tool of ASP.NET 2.0 allows you to manage end-users. You can add and edit end-users, their roles, and access rules using the Security window of the tool. By default, all end-users can access a Web site. You can configure the security window to restrict the access to your Web site or Web pages. You can assign different roles to end users by selecting the check boxes of available roles in the security window of the Web Site Administration Tool.

2.29 MANAGING PROVIDERS

End-user information, such as login name, password, and roles assigned to the end-users, are stored in a database, known as provider. You can click the Provider hyperlink of the Web Site Administration Tool and enter the end-user information in the text box to add a new provider. When you add a new provider, ASP.NET 2.0 automatically creates a database in the data folder of the Web application. The database contains predefined tables to store end-user information, such as roles and profiles.

2.30 MONITORING .NET WEB APPLICATIONS

ASP.NET 2.0 provides various features that help monitor Web applications. Some of these features include:

• Debugger Visualization: Enables you to view the values stored in any variable of a Web application. You can view the values in a text, html, or xml browser.

• Unicode Transformation Format (UTF): Enables you to import and export log results to computers running on different operating systems or protocols. UTF ensures that the log results are readable regardless of the operating system or protocol used by the computer.