ASP.NET HTTP Pipeline

Hypertext transfer protocol (HTTP)

You are doing ASP.NET development on virtual/shared hosting, and you need some pointers on how you can make IIS 7 work well with an ASP.NET application. You may have problems with 404 errors not working properly on a shared host. Here we look at how the pipeline functions on a shared hosting plan, such as Go Daddy.

This ASP.NET article examines the pipeline. It shows how files are handled based on their types.

Introduction

Here we look at how IIS 7 (or earlier releases) works in conjunction with ASP.NET to serve files. This is particularly confusing when you don't have your own server. Both IIS and ASP.NET work in the same pipeline, and here are some important points.

Some files are mapped to ASP.NET The administrators of your server will have mapped some files (at the minimum *.aspx) to ASP.NET. When a request that is for any .aspx file (whether it exists or not), ASP.NET takes over.

Static files handled separately Shared hosts like Go Daddy will map static files (HTML, GIF, CSS) to the IIS server. ASP.NET will not run or receive these requests.

Global.asax only runs with ASP.NET Files that are served from IIS do not go through Begin_Request in ASP.NET. This means that ASP.NET is oblivious to those files.

Pipeline examples

Please note that all of these settings can be manually changed, but these are how things are with many shared ASP.NET hosts (including the most popular ones). If you have your own server, consider yourself lucky.

Extensions mapped to ASP.NET

*.aspx
*.ashx

Extensions mapped to IIS 7

*.html
*.gif
*.swf
*.jpg
*.js
*.css
directories

Directories

As shown in the previous table, directories are handled separately still. When IIS receives a request for a directory, it will handle that request if the directory is there. If the directory isn't there, then it will send the request to ASP.NET. This means that ASP.NET cannot intercept a request for a directory that exists.

Notes

This section provides information

You might be wondering what should be done in Global.asax. On a shared host or any setup where only asax files are processed by ASP.NET, handle only *.aspx files in Global.asax. Requests that are not received by ASP.NET will never come through Begin_Request in Global.asax.

Can it get more confusing? Yes. The default ASP.NET development server in Visual Studio 2008 acts differently than shared hosts like the ones that behave in this way. Your site will handle errors differently locally than remotely. Make sure to test thoroughly.

Summary

ASP.NET web programming framework

Here we looked at some concepts related to HTTP pipeline handling in ASP.NET. Keep in mind the inconsistencies between file mapping and handling on different ASP.NET servers and hosts. The platform uses a pipeline model, where the software tries to handle each request first by IIS and then, if specified, by ASP.NET. ASP.NET doesn't handle all file types.

ASP.NET Tutorials
.NET