Results 1 to 4 of 4

Thread: Visual Studio Virtual Directory issues

  1. #1

    Thread Starter
    Member Comn8u's Avatar
    Join Date
    Jul 2004
    Posts
    35

    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?
    It's not the size of the dog in the fight, it's the size of the fight in the dog.

  2. #2
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    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?)

  3. #3

    Thread Starter
    Member Comn8u's Avatar
    Join Date
    Jul 2004
    Posts
    35

    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.
    It's not the size of the dog in the fight, it's the size of the fight in the dog.

  4. #4
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width