With Dev’garten, I have the actual ASP.NET 2.0 site hosted on a virtual server instance running IIS, and the actual web site is located under a virtual directory.
So on the actual server, any internal references pan out to be:
Because I’m using ISA Server 2004 as a reverse proxy, I had to set up a path translation, so that when people type in http://www.devgarten.com/default.aspx, ISA changes the internal request to the web server to http://localhost/devgarten/default.aspx:
Now, this is where it gets a little tricky. In ASP.NET 2.0, if I use the magic tilde (~) on the server to map the root, the ASP.NET filter returns URLs that contain the internal structure of http://localhost/devgarten/default.aspx for example. What happens to the localhost you ask, because in Dev’garten’s site, it comes back as http://www.devgarten.com/devgarten/default.aspx. Well, ISA has a filter called the Link Translation filter, and it autopopulates an entry to do the reverse path from http://localhost/devgarten/* to http://www.devgarten.com/devgarten/*. Very clever. Except, if the clients browser tries to make the web server request for the resource http://www.devgarten.com/devgarten/imgs/x.jpg for example, it’s not going to find it, because ISA doesn’t publish that extra bit of the /devgarten path. That’s purely from the internal server. So what you need to do is create a compensating Link Translation that says:
So, when incoming requests ask for http://www.devgarten.com, they get the virtual directory appended through the Path config, and when the web server is returning content to the client browser, the /devgarten folder path is scrubbed by the Link Translation config. If you forget one or the other, it’s all going to go a little funny. Also, make sure you have configured your host headers correctly on your IIS box too, or you’ll get host not found errors.
Ahh, the adventures of the developer in infrastructure land 🙂 But I have to say, I’m liking ISA Server 2004 more and more every day!