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

A

Amil Hanish

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
 
S

Shawn Wildermuth (C# MVP)

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

Forum statistics

Threads
473,996
Messages
2,570,237
Members
46,825
Latest member
VernonQuy6

Latest Threads

Top