I have a website that has a relative path to a stylesheet that looks like this "/stylesheets/main.css". Now this works fine when I run the site in Visual Studio. But when I deploy the site to our Windows Server 2003 the path stops working. If I go back into code and change the path from "/stylesheets/main.css" to "stylesheets/main.css", the site works fine on the server. I have another website on a different server that uses the same path style ("/stylesheets/main.css") and stylesheet and works with no problems. I really don't want to change all the paths, and am not even sure if this is a problem with the code or the server. Any help or ideas would be great. Thanks.
Is the site deployed to the domain's root? If the site is at
http://example.com/somefolder/
then the path /stylesheet/main.css
will be interpreted as
http://example.com/stylesheet/main.css
rather than
http://example.com/somefolder/stylesheet/main.css
As @Kit indicated, you can work around this by resolving the path to your application's folder. I have often done this in ASP.NET as follows:
<link rel="stylesheet" type="text/xss" href="<%= ResolveUrl("~/stylesheet/main.css") %>"/>
If that's not the problem, you're going to have to give a bit more detail.