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.
Share
Is the site deployed to the domain’s root? If the site is at
then the path
/stylesheet/main.csswill be interpreted asrather than
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:
If that’s not the problem, you’re going to have to give a bit more detail.