Click here to Skip to main content
Click here to Skip to main content

New Multisite DLL Or How to develop .NET project in a Root

, 8 Apr 2005
Rate this:
Please Sign up or sign in to vote.
Utility to ease .NET development.


How many times you probably wished that you can develop your .NET project in the root folder or host multiple websites on Win XP. If at least one time, then read on.

The problem with developing in the root is that VS does not really support that (although doable). Also, very often, I work on several projects or just simply would like to have a project in its own folder so that when I need I can easily bring it up for debugging/modifying without messing up all other projects.


I have come across multisite.dll (probably very well known) which allows to map different host names to different URLs. So I could setup to /project1 folder, to /project2 folder ... But this DLL does not work with .NET. The only thing it works well with is simple HTML, which basically makes it worthless.

But that made me wonder, what prevents it from working with .NET. After reading some documentation on ISAPI, I figured that the problem lies in how it handles the request.

When browser hits the IIS with, IIS converts the URL "/default.aspx" to physical path "C:\inetpub\wwwRoot\default.aspx". Only then that DLL gets its grip on the request and modifies physical path to the correct path "C:\inetpub\wwwRoot\project1\default.aspx". The first thing ASP.NET application does is, check for web.config and global.asax in the root folder and since the URL has not been changed the ASP.NET looks for those files in "\" folder and not in "\project1" folder, thus skipping to load config.asax or web.config making any serious project development with that version of Multisite.dll useless.

After I had realized that, I understood that the solution is to modify URL and not a physical path. After reading documentation more carefully, I discovered that SF_NOTIFY_PREPROC_HEADERS in conjunction with GetHeader, SetHeader will do exactly what I need.

  1. Browser hits the IIS with
  2. DLL modifies it to

Everything else is the same as if we would hit the URL from the beginning. ASP.NET finds proper global.asax and web.config and works without even knowing that modification has been done.

Implementation of New Multisite DLL

  1. This step need to be done only once when you install my multisite.dll. Copy multisite.dll and config.ini in some folder then register it as ISAPI filter with IIS.
  2. Let's say you have .NET project. Let's say Project1. And you want it to be on
  3. Modify HOSTS file in C:\WINDOWS\system32\drivers\etc. Add a new line:
  4. Modify config.ini in the same folder where mulitsite.dll is. Add a new line: = /Project1

    Note, not www. Becasue www. will be stripped out automatically so it works as in real world.

  5. Restart IIS server. After that every time you hit the URL will be converted to and everything will work. When you are done with the project, you simply need to copy everything to root folder of the production website. No modifications needed.

Important Notes

  1. Safely assume that your project is working from the root so that all images, css files, js files might be referenced from the root. No need to append the project name and then when moved to production rename all of them.
  2. Where possible use root "/" or "~" symbol of .NET in constructions like Response.Redirect("~/mypage.aspx") Or Response.Redirect("/mypage.aspx"). Do not use your project name. The construction Response.Redirect("~/mypage.aspx") will be translated to Response.Redirect("/project1/mypage.aspx"). Because of that multisite DLL will not modify the path. I.e., the path will not be touched and will be passed as is to IIS. (The key here is that first folder in URL matches mapping folder).
  3. In current implementation you need to restart IIS so that all changes in config.ini will be loaded.
  4. Debug is fully supported but because when you press F5 in Visual Studio, it opens http://localhost/.... You need to either map localhost to /Project1 or have a separate browser window point to and do all testing there. It's up to you which way to go but if you mapped localhost then do not forget to unmap it. Or you will not be able to access any other file on IIS outside of Project1 folder.
  5. It's crucial to have in config.ini the project folder to start with '/' symbol.
  6. Do not prefix names with www. in config.ini. www. is stripped out from the request to make it work like real web application. If you want both www. and non www. version of the working site, you need to add two lines to host file though. One for www. name and one without www. name!


I found that this small utility is very useful in my development work. I can keep all my projects running on my development machine and if needed easily be modified and uploaded on a production server. No need to run a "Replace ALL" to eliminate the project name.

Also it came very handy on my production server Ms.Piercing where I have multiple websites and instead of using the ability of IIS to run multiple instances of WWW, I am using my DLL to do that (it seems to me more lightweight).

If you have any questions about this DLL feel free to send me an email (remove nospam) or visit my website. I am planning to write next version which will not require to restart IIS every time you modify config.ini.


This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


About the Author

Web Developer
United States United States
I am a Senior Software developer who does a consulting work for several companies. Mostly it's an E-Commerce project.
I do have my own venture. Small online store my wife runs. Body Jewelry. Also visit Piercing info Cool thing is that nor I nor my wife has any piercings. My new website is Belly ring

Comments and Discussions

Question4.0 version PinmemberGlay200924-Jan-13 19:09 
GeneralBig Thanks Pinmemberthewondersnarf11-Mar-11 1:02 
GeneralMultiSite for XP64 Pinmembermetastar21-Jan-11 21:53 
QuestionHow do u acutally start the multiple sites at the same time? PinmemberRichTrawinski271-Mar-10 17:56 
AnswerRe: How do u acutally start the multiple sites at the same time? PinmemberGevorg2-Mar-10 3:44 
GeneralWorks well, except for long URLs Pinmembernaasking21-Jul-09 7:55 
QuestionMaybe I'm missing something PinmemberMike william27-Jan-07 17:31 
GeneralWin 2k Pinmembermaxwell_hung13-Dec-05 1:35 
I installed this on my XP pro machine and it seems to work great but on win 2k it doesn't
config file is
when I browse to test.local/default.aspx
I get a .net error saying it can't find the file at
GeneralRe: Win 2k PinmemberGevorg14-Dec-05 18:36 
Questiondoesn't like classic asp include files? Pinmembertfs_mag17-Oct-05 17:26 
AnswerRe: doesn't like classic asp include files? PinsussAnonymous19-Oct-05 6:18 
GeneralDebugging Pinmemberekhanh10125-Aug-05 8:31 
GeneralRe: Debugging PinmemberGevorg25-Aug-05 16:21 
GeneralRe: Debugging Pinmemberekhanh10125-Aug-05 16:30 
GeneralRe: Debugging Pinmemberekhanh10125-Aug-05 16:52 
GeneralGreat! PinmemberCoderproj15-Jun-05 7:43 
GeneralWorking perfect after a few restarts... PinmemberRichard Bladh28-Apr-05 6:52 
QuestionWhich DLL? PinmemberArman27-Apr-05 8:45 
AnswerRe: Which DLL? PinmemberGevorg8-Apr-05 16:32 
QuestionIt won't work. What's wrong? PinmemberArman27-Apr-05 8:41 
AnswerRe: It won't work. What's wrong? PinmemberGevorg8-Apr-05 16:59 
AnswerRe: It won't work. What's wrong? Pinmemberdr_fission14-Jul-05 5:37 
Generalalmost perfect Pinsussjfincke9-Mar-05 6:07 
GeneralRe: almost perfect PinmemberGevorg9-Mar-05 9:41 
QuestionHow is this different than using Host headers in IIS? PinsussAnonymous7-Mar-05 13:45 
AnswerRe: How is this different than using Host headers in IIS? PinmemberGevorg7-Mar-05 17:14 
AnswerRe: How is this different than using Host headers in IIS? PinmemberCoderproj15-Jun-05 7:33 
GeneralYou can debug using the URL PinmemberMarc Brooks7-Mar-05 10:41 
GeneralRe: You can debug using the URL PinmemberGevorg7-Mar-05 17:20 
GeneralRe: You can debug using the URL PinsussMikeEast15-Apr-05 3:42 
GeneralRe: You can debug using the URL PinmemberGevorg15-Apr-05 17:57 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web04 | 2.8.150327.1 | Last Updated 8 Apr 2005
Article Copyright 2005 by Gevorg
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid