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:
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:
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." |