Overview of ASP.NET Applications


An ASP.NET application consists of all files located within a particular virtual directory. The virtual directory can be the default directory (the wwwroot directory), or it can be a new virtual directory that you have defined by using the Internet Services Manager.

To create a new virtual directory, follow these steps:

  1. Launch Internet Services Manager by going to Start, Administrative Tools, Internet Services Manager.

  2. Right-click your default Web site and choose New, Virtual Directory.

  3. Provide the virtual directory with an alias (for example, myApp ).

  4. Choose a physical directory for the virtual directory. It can be located anywhere on your hard drive.

  5. Choose the access permissions for the virtual directory. You need to enable both Read and Run scripts to execute ASP.NET pages.

After you create a new application by creating a virtual directory, you can access pages in the application by using URLs that look like this:

http://yourSite.com/myApp/default.aspx

This URL accesses a page located in the myApp application.

All the pages running in an application are isolated within an application domain. Separating a Web site into multiple application domains, by creating virtual directories, has a number of benefits:

  • Code that executes within one application cannot directly access code or resources in another application. So, you can host multiple applications on a single Web server without worrying about unintended interactions between the different applications.

  • If one application is shut down (or it crashes), it has no effect on other applications running on the same server. Therefore, flaky code executing in a preproduction Web site can be isolated from code running on a live Web site.

  • Assemblies in one domain are not shared with other domains. For example, one application can use a different version of a component without any conflict with other applications.

  • You can set applicationwide security policies. The code executing in a trusted application domain can be subject to a different set of permissions than code running in another untrusted application domain.

  • You can specify configuration settings that apply to one application and not another. For example, you can enable tracing and debugging for one application and not another application.

Every application can contain a special directory and two special files. The special directory is named /bin . This directory must be located in the root directory of the application.

NOTE

After you create a new virtual directory, you need to add the /bin directory to the application yourself.


The /bin directory contains custom components and controls (in the form of assemblies). Any component or control added to the /bin directory is automatically visible to all pages executing within the application. For example, if you create a new custom control named SuperDataGrid , you need to place this control in the /bin directory so that you can use it in your ASP.NET pages.

ASP CLASSIC NOTE

In versions of Active Server Pages prior to ASP.NET, you needed to shut down the current application before you modified any of the components in an application. When using ASP.NET, in contrast, you can simply replace an old component with the new component in the /bin .directory.


An application can also contain a special file named Global.asax . This file also must be located in the root directory of an application.

The Global.asax file contains subroutines that handle applicationwide events and objects declared with application scope. You learn how to create this file later in this chapter in the section titled "Using the Global.asax File."

Finally, an application can contain in its root directory a Web.Config file that specifies configuration information for the entire application. You learn how to use this file later in this chapter in the section titled "Using the Web.Config File."



ASP.NET Unleashed
ASP.NET 4 Unleashed
ISBN: 0672331128
EAN: 2147483647
Year: 2003
Pages: 263

Similar book on Amazon

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net