You are on page 1of 8

July 2011 Master of Computer Application (MCA) Semester 5 MC0081 .

(DOT) Net Technologies 4 Credits


(Book ID: B0974)

Assignment Set 1 (40 Marks)


Answer all Questions 1. Describe the following: o Importance of ADO.Net The ADO.NET has been developed to enhance the creation of powerful and scalable web applications, by working with data in a disconnected way under the .Net frameworks stateless distributed web model. It has been specifically designed to operate in a 3-tier environment. As the ADO.NEToperates in a disconnected way, no longer remaining connected to the data server while performing positional updates, there is a far great scope for data manipulation. ADO.NET was first introduced in version 1.0 of the .NET framework that provided an extensive array of features to handle live data in a connected mode or data that is disconnected from its underlying data store. Today with the explosion of the Internet as a means of data communication, a new data technology is required to make data accessible and updateable in a disconnected architecture. o Data Access Scenarios I. The most popular data access scenario in the Internet is the one in which a user must locate a collection of data and iterate through this data a single time. Each question carries TEN marks

When a request for data from a Web page that you have created is received, you can simply fill a table with data from a data store. In this case, you go to the data store, grab the data that you want, send the data across the wire, and then populate the table. In this scenario the goal is to get the data as fast as possible. II. The second way to work with data in a disconnected architecture is to grab a collection of data and use this data separately from the data store itself. This data could be either on the client machine or the server machine. Even though the data is disconnected, you want the ability to keep the data (with all of its tables and relations in place) on the client side. DO.NET is a reflection of the data store itself, with tables, columns, rows, and relations all in place. When completed working on the client side copy of the data, the changes done to the data could be made persistent back into the data store from where the data was retrieved. The technology that enables the user or the programmer to perform this task is the DataSet. Like their counterparts in the unmanaged world, managed applications can and often do utilize industrial-strength databases such as Microsoft SQL Server and Oracle 8i. Thats why Microsoft created ADO.NET, an elegant, easy-to-use database API for managed applications. ADO.NET is exposed as a set of classes in the .NET Framework class librarys System. Data namespace and its descendants. Unlike ADO and OLE DB, its immediate predecessors, ADO.NET was designed from the outset to work in the connectionless world of the Web. It also integrates effortlessly with XML, bridging the gap between relational data and XML and simplifying the task of moving back and forth between them. 2. With the help of a suitable example, explain the steps involved in editing, compiling and running a C# program. The Hello C# Program:

You can use any editor to code the program. Its up to your convenience as to which editor to use. Listing 1 shows the coding for our Hello C# program: Listing 1 using System; class Hello { public static void Main() { Console.WriteLine(Hello C#); }} After entering the above code in an editor, you have to perform the following steps Save the file as Hello.cs. cs is an extension to indicate C-Sharp like .java for a Java source file. You have to supply this extension while saving your file, otherwise the code will not compile correctly. The saved file will be of the extension .cs.txt. Compile the code by giving the following command at the command prompt: csc Hello.cs If there are compile errors you will be prompted accordingly. Otherwise, you will be viewing a command prompt along with the copyright information. As a final step, you have to execute the program in order to view the final output. For that purpose, you have to simply give a command as shown below at the command prompt. See above figure. If everything goes on well, then you can be able to view the message Hello C# as shown in the figure above. 3. Discuss the following:

Web.config file
Web.config is the main settings and configuration file for an ASP.NET web

application. The file is an XML document that defines configuration information regarding

the web application. The web.config file contains information that control module loading, security configuration, session state configuration, and application language and compilation settings. Web.config files can also contain application specific items such as database connection strings. ASP.Net Applications of XML have been integrated into such an extent that XML format for the exchange of data, its also used to store configuration settings. 1. A Web application can contain more than one Web.config file. The settings in a file apply to the directory in which its located, and all child directories. Web.config files in child directories take precedence over the settings that are specified in parent directories. 2. Web.config files are protected by IIS, so clients cannot get to them. If you try to retrieve an existing http://?????.com/Web.config file, youll be presented with an Access denied error message. 3. IIS monitors the Web.config files for changes and caches the contents for performance reasons. Theres no need to restart the Web server after you modify a Web.config file.

Global.asax Application File


The Global.asax file is an optional file used to declare and handle application

and session-level events and objects for an ASP.NET web site running on an IIS Web Server. The file contains ASP.NET program code, and is the .NET counterpart of the Global.asa file used for ASP. The Global.asax file resides in the IIS virtual root of an ASP.NET application. At run time, upon the arrival of the first request, Global.asax is parsed and compiled into a dynamically generated .NET Framework class. ASP.NET is configured so

that any direct request for the Global.asax is automatically rejected; external users cannot view or download the code in it. Code to handle application events (such as the start and end of an application) resides in Global.asax. Such event code cannot reside in the ASP.NET page or web service code itself, since during the start or end of the application, its code has not yet been loaded (or unloaded). Global.asax is also used to declare data that is available across different application requests or across different browser sessions. This process is known as application and session state management. The Global.asax file must reside in the IIS virtual root. A virtual root can be thought of as the container of a web application. Events and state specified in the global file are then applied to all resources housed within the web application. If, for example, Global.asax defines a state application variable, all .aspx files within the virtual root will be able to access the variable. The ASP.NET Global.asax file can coexist with the ASP Global.asa file. A Global.asax file is created in either a WYSIWYG designer or as a compiled class that is deployed in an applications \Bin directory as an assembly. However, in the latter case, the Global.asax file must refer to the assembly. Like an ASP.NET page, the Global.asax file is compiled upon the arrival of the first request for any resource in the application. The similarity continues when changes are made to the Global.asax file: ASP.NET automatically notices the changes, recompiles the file, and directs all new requests to the newest compilation.

4. Discuss the following:

IIS Architecture
Internet Information Services (IIS) version 6.0, which runs on all editions of the

Microsoft Windows Server 2003 operating system, provides a new architecture that offers flexibility in the choice of two application isolation modes. The new architecture helps you run

a faster Web service that is more reliable and secure. IIS 6.0 provides a redesigned World Wide Web Publishing Service (WWW service) architecture that can help you achieve better performance, reliability, scalability, and security for your Web sites, whether they run on a single server running IIS or on multiple servers. IIS 6.0 runs a server in one of the two distinct request processing models, called Application Isolation Modes. Application Isolation is the separation of applications by process boundaries that prevents one application or Web site from affecting another and reduces the time that you spend restarting services to correct problems related to applications. In IIS 6.0, application isolation is configured differently for each of the two IIS application isolation modes. Both modes rely on the HTTP protocol stack (also referred to as HTTP.sys) to receive Hypertext Transfer Protocol (HTTP) requests from the Internet and return responses. HTTP.sys resides in kernel mode, where operating system code, such as device drivers, runs. HTTP.sys listens for, and queues, HTTP requests. The new request-processing architecture and application isolation environment enables individual Web applications, which always run in user mode, to function within a selfcontained worker process. A worker process is user-mode code whose role is to process requests, such as returning a static page or invoking an Internet Server API (ISAPI) extension or filter. Worker processes use HTTP.sys to receive requests and send responses over HTTP.

IIS Request Processing Models


Worker process isolation mode is the new IIS request processing model. In

this application isolation mode, you can group Web applications into application pools, through which you can apply configuration settings to the worker processes that service those applications. An application pool corresponds to one request routing queue within HTTP.sys and one or more worker processes. Worker process isolation mode enables you to completely separate an application in its own process, with no dependence on a central process such as Inetinfo.exe to load and execute the application. All requests are handled by worker processes that are isolated from the Web server itself. Process boundaries separate each application pool so that

when an application is routed to one application pool, applications in other application pools do not affect that application. By using application pools, you can run all application code in an isolated environment without incurring a performance penalty. For a visual representation of worker process isolation mode architecture, see Figure below.

Worker process isolation mode delivers all the benefits of the new IIS 6.0 architecture, including multiple application pools, health monitoring and recycling, increased security and performance, improved scalability, and processor affinity. For example, the new

health monitoring features can help you discover and prevent application failures, and can also help protect your Web server from imperfect applications.

You might also like