Visual Studio built-in server adds directory (locally)

Hello,

This has been an annoyance for a while now. When running a website project locally, the built-in server makes the root "localhost:port/directory/", where directory is the name of the directory in which the project resides. This creates a problem once you start adding css files with background images that use absolute path. Is there a way to have it run locally without it appending the directory name or some other way that will allow to use absolute paths locally?

Thanks!
luefherAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
luefherConnect With a Mentor Author Commented:
Found the solution:

When you have a project running on a local server, click on the project name in the solution explorer and change the virtual path to '/' in the properties. That does it!
0
 
Bob LearnedCommented:
Why do you need to use absolute paths with CSS styles?

Bob
0
 
luefherAuthor Commented:
no particuluar reason, i am used to using absolute paths...
0
 
Bob LearnedCommented:
Things work best with relative paths, since you can rehome a web site without having to change anything.  A lot of ASP.NET examples will show relative pathing.  I think that your problem will evaporate with relative pathing.

Bob
0
All Courses

From novice to tech pro — start learning today.