I’ve just finished writing my first proper ASP.NET web page and just been through a mental-workout trying to get more than one of them hosting at the same time on Somee. By that, what I mean is that on my host, I want to have a directory structure like this:
With each sub-directory having its own files and resources so that I could go to URLs like this:
Should be easy, right? My first idea was just to copy all my published files into each directory and try that, but it-does-not-work!
The problem was that I could store one web application in the root directory (and have it work), but when I tried doing the same for another application in a sub-directory, suddenly it all went awry. There were a host of different errors, but the gist was that I could access my Default.aspx file, but all resources, including the assemblies, were inaccessible.
I got a little closer by copying the dll file in a bin directory to the root, but all my graphics still remained unobtainable. It was as if when looking for required files, it would go to the root folder instead of the sub-directory. Sigh.
My Google inspired path took me to web.config files, default files, url mapping, transformations and more, and honestly, eventually the answer was ridiculously easy. If you are in the same position, this is what you need to do:
- In the Applications section of your control panel, add your sub-directory as an application and click OK!
I can’t believe how easy it is! Below are some images of what it looks like on Somee in case you use that company but I bet it is very similar on other hosts or if you have access to IIS directly.
- Choose Applications. You can see above where that lies on Somee.
- Select your directory (which you should have already created) and click on Convert folder to Application. Give it a short while and it should be fine. Note: don’t forget to copy your files in there, too!
Hope that helps.
Hi! Did you find this useful or interesting? I have an email list coming soon, but in the meantime, if you ready anything you fancy chatting about, I would love to hear from you. You can contact me here or at stephen ‘at’ logicalmoon.com