IIS 6.0 – Disabling ASP.NET on all virtual directories, but one?

One of my customer running IIS 6.0 had this special scenario where he would like to run ASP.NET 2.0 applications only on a single virtual directory on the entire server. He would like to isolate his Virtual Directory alone to have the ScriptMaps of ASP.NET, but not any other website or virtual directory or a folder.

The ScriptMaps for a virtual directory would generally come from the master level properties. To get this in IIS manager, click on the “Web Sites” folder and get its properties, under home directory -> configuration, you will find the script maps configuration. Remove everything regarding ASP.NET.

Now, none of your web sites, virtual directories would have ASP.NET script maps (unless you’ve specifically added them there).

So, now what? How to add the script maps for a specific virtual directory alone? Run aspnet_regiis with below options:

aspnet_regiis -s “<PATH”>

e.g: aspnet_regiis -s “W3SVC/1/Root/MyVDir”

By the above command, the ASP.NET script maps would only be registered to MyVdir virtual directory under the web site with identifier 1.

Hope this helps!