Visual Studio Virtual Directory issues
Why is it when I link files (example would be a CSS file in an aspx page) in Visual Studio (localhost), I have to add the project name in the link for it to work?
Example:
<LINK href="/PROJECTNAME/includes/styles.css" type="text/css" rel="stylesheet">
instead of using the right way:
<LINK href="../includes/styles.css" type="text/css" rel="stylesheet">
How can I correct this?
Re: Visual Studio Virtual Directory issues
It depends on where you are using this. If it gets called from a page that is not in a subdriectory, then it would translate to another path, and you end up with no stylesheet. Where are you calling this from (Some ascx?)
Re: Visual Studio Virtual Directory issues
It would be in a sub folder of the root directory in the example, but even when I include a style sheet or even a ascx, or whatever, I still have to add the (project name) to the path on my machine using localhost. When I transfer it to a live server, I have to remove the project name from all the links so that it works on the live server. That becomes cumbersome because I might have many links to change when going live. Is there something I can configure to stop this from happening and to avoid using the project name in the links at all?
Thanks for the reply.
Re: Visual Studio Virtual Directory issues
So that means
../includes/styles.css
would translate to
C:/Inetpub/Wwwroot/includes/styles.css
?
Trust me, there's no 'bug' here, it's just a small case of paths.
Try it with includes/styles.css instead.