471,620 Members | 1,184 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,620 software developers and data experts.

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.


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.

Shawn Wildermuth
Speaker, Author and C# MVP
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.


Jul 26 '06 #1
0 1209

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
1 post views Thread by XIAOLAOHU | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.