absolute paths when using "View in Browser" on local port

Discussion in 'ASP .Net' started by Amil Hanish, Jul 17, 2006.

  1. Amil Hanish

    Amil Hanish Guest

    I use the VS 2005 option "View in browser" to often view my web site. If I
    have a link in there like:

    <img src="/graphics/myimage.jpg">

    This doesn't work even though the image is really there. I'm sure this has
    to do with the fact that the page is being served out of the virtual
    server/port that VS fires up to serve the page.

    This seems bogus...I can't even see my content? Am I doing something wrong?
    I've tried using stuff like ~/graphics/myimage.jpg, but that doesn't work
    either.

    Amil
    Amil Hanish, Jul 17, 2006
    #1
    1. Advertising

  2. Hello Amil,

    Typically you'll need it to be a relative path not a root path for this to
    work. I usually do the ~/graphics/myimage.jpg trick, but that means that
    the <img /> needs a runat="server" in the tag.

    HTH


    Thanks,
    Shawn Wildermuth
    Speaker, Author and C# MVP
    http://adoguy.com

    > I use the VS 2005 option "View in browser" to often view my web site.
    > If I have a link in there like:
    >
    > <img src="/graphics/myimage.jpg">
    >
    > This doesn't work even though the image is really there. I'm sure
    > this has to do with the fact that the page is being served out of the
    > virtual server/port that VS fires up to serve the page.
    >
    > This seems bogus...I can't even see my content? Am I doing something
    > wrong? I've tried using stuff like ~/graphics/myimage.jpg, but that
    > doesn't work either.
    >
    > Amil
    >
    Shawn Wildermuth (C# MVP), Jul 17, 2006
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Donald
    Replies:
    1
    Views:
    470
    Roel van der Steen
    Mar 7, 2004
  2. Noah
    Replies:
    5
    Views:
    769
  3. Amil Hanish
    Replies:
    0
    Views:
    310
    Amil Hanish
    Jul 26, 2006
  4. Ohad Lutzky

    Paths, gentleman, paths

    Ohad Lutzky, Nov 6, 2006, in forum: Ruby
    Replies:
    2
    Views:
    185
    David Vallner
    Nov 7, 2006
  5. Replies:
    1
    Views:
    556
    Toni Erdmann
    Mar 2, 2005
Loading...

Share This Page