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

A

Amil Hanish

Earlier I had inquired as to why a normal <a href> tag 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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,825
Latest member
VernonQuy6

Latest Threads

Top