1. Computing

ASP.NET Application - A Definition and Explanation

What's in an "ASP.NET Application"?

By

Updated October 31, 2010

Hopefully, you reached this page from the About Visual Basic ASP.NET Hub Page. If not, you might want to click the link above and go there.

When you click an ASP.NET URL, you're sending a request to a server that might send back a whole lot of things from a simple static HTML page to a multimedia display with content from a dozen other servers. Where is the boundary on what is part of the "application" in ASP.NET and what isn't?

There's actually a pretty clear answer.

The first thing to recognize is that when the web server receives the request, it just passes it on to the ASP.NET worker process. That's where boundaries are maintained. The ASP.NET worker process carefully keeps code execution divided into different application domains that are based on the virtual directory structure. When an ASP.Net request is first received, a new AppDomain is created in the worker process. This process then handles subsequent ASP.NET requests.

A virtual directory is the path in the URL you send to IIS. IIS maps this path to the actual location of the content: the application files. The actual location of the files could be anywhere. IIS uses the URL you send to look up where they really are. As Microsoft states it, "You can use virtual directories to include content in your application without having to move or copy files to the application's directory."

Although you can use the command line utility Appcmd.exe, or even edit configuration files in Notepad, the normal way to manage virtual directories is to use the IIS 7 IIS Manager program. (One way to start it is with the Inetmgr "Snapin" in MMC.) This screen shot below shows a new virtual directory being added into one that already exists.

Click Here to display the illustration
--------

If a web page is hosted in the same virtual directory (or one of its subdirectories) then it's part of the same application domain. Web pages in different virtual directories execute in separate application domains. This keeps things organized and keeps your application secure. The system enforces the rule. In short, an ASP.NET application is the set of files that delivers content or provides services. The screen shot below shows those files for one test system I was working with as shown by IIS Manager using the Actions pane (right side column) selection "View Virtual Directories".

--------
Click Here to display the illustration

The concept of an application pool is also part of the definition of an application. Application pools let you configure the way web applications behave. For example, the application pool settings determine what version of .NET your application gets and how long it can remain idle. Although application pools are similar to application domains, the definition is a little more broad. An application pool can configure one or more application domains but will usually consist of just one. It might help to understand that application pools are used by IIS to configure websites. Application domains are a part of the .NET infrastructure.

Another thing to be aware of is how to execute code that isn't triggered by any specific event in any control, but rather depends on an event for the application. That happens in a special file that isn't even present in some web sites called Global.asax.

©2014 About.com. All rights reserved.