468,783 Members | 1,684 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,783 developers. It's quick & easy.

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

Earlier I had inquired as to why a normal <a hreftag didn't work when
using the VS hosted site using a random local port. The more I think about
it, this seems very wrong.

Using the random port hosted site, if I have <a href="/mypage.aspx">, this
link doesn't seem to work? I've verified this by creating a simple .htm
page with a link like this, then do a "View in browser". Clicking the link
results in page not found. I guess this is because the normal href doesn't
specify the port, eh?

Doesn't this seem bogus? It sure makes things harder to test. Granted you
can use a <asp:HyperLink>, but that seems like overkill in many cases.

Amil

========================
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


Jul 26 '06 #1
0 1129

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

18 posts views Thread by Lorem Ipsum | last post: by
1 post views Thread by dw | last post: by
1 post views Thread by Nalaka | last post: by
reply views Thread by zhoujie | last post: by
2 posts views Thread by Marin | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.