N
nick
I have a problem and I've been using a cheezy work around and was
wondering if anyone else out there has a better solution.
The problem:
Let's say I have a web application appA. Locally, I set it up as
C:\domains\appA. Locally, my IIS root points to C:\domains. I don't
point it to C:\domains\appA since if I have an appB under C:\domains I
wouldn't be able to get to it. So to access it via my browser I go to
localhost/appA.
When deployed, the IIS website's root points not to domains, but one
directory deeper to appA. This is because I don't want to type
www.appA.com/appA, but just www.appA.com.
So, the above is the typical way of setting up web projects with
ASP.NET when you've got a local version and a final version on a
server somewhere.
The problem is with virual paths in the browser. If I want to point to
an image locally which is in C:\domains\appA\images\myImage.gif in the
client side code I write "/appA/images/myImage.gif". Obviously this
doesn't work when deployed since the path from the root is different.
Rather, the correct path is "/images/myImage.gif".
The work around I've used is locally to switch the root of my website
everytime I want to work on a different project so that the structure
of the site mirrors that of the site when deployed. This is obviously
a big pain in the butt.
The problem would go away if M$ allowed more than one website in IIS
in non-server versions of their OS, but, well, they don't. That's one
of the joys I've had doing PHP development on Apache - no screwing
around with in IIS every time I want to work on a different site
locally.
So, does anyone have better solutions that the one I've been using?
I realize I could dynamically generate the paths server side, but,
well, that's a pretty cheezy solution.
Oh yeah, and please remember I'm talking about _client_ side paths. I
know already about ~/directoryName on the server.
wondering if anyone else out there has a better solution.
The problem:
Let's say I have a web application appA. Locally, I set it up as
C:\domains\appA. Locally, my IIS root points to C:\domains. I don't
point it to C:\domains\appA since if I have an appB under C:\domains I
wouldn't be able to get to it. So to access it via my browser I go to
localhost/appA.
When deployed, the IIS website's root points not to domains, but one
directory deeper to appA. This is because I don't want to type
www.appA.com/appA, but just www.appA.com.
So, the above is the typical way of setting up web projects with
ASP.NET when you've got a local version and a final version on a
server somewhere.
The problem is with virual paths in the browser. If I want to point to
an image locally which is in C:\domains\appA\images\myImage.gif in the
client side code I write "/appA/images/myImage.gif". Obviously this
doesn't work when deployed since the path from the root is different.
Rather, the correct path is "/images/myImage.gif".
The work around I've used is locally to switch the root of my website
everytime I want to work on a different project so that the structure
of the site mirrors that of the site when deployed. This is obviously
a big pain in the butt.
The problem would go away if M$ allowed more than one website in IIS
in non-server versions of their OS, but, well, they don't. That's one
of the joys I've had doing PHP development on Apache - no screwing
around with in IIS every time I want to work on a different site
locally.
So, does anyone have better solutions that the one I've been using?
I realize I could dynamically generate the paths server side, but,
well, that's a pretty cheezy solution.
Oh yeah, and please remember I'm talking about _client_ side paths. I
know already about ~/directoryName on the server.