image not displayed (Relative path of image)

For some reason I can't seem to get the image to display.  In the layout page I have used the following variations for the image.

<img src="/Content/Images/image2.jpg" />
<img src="/../Content/Images/image2.jpg" />
<img src="../Content/Images/image2.jpg" />
<img src="http://" & Request.ServerVariables("MyServer") & Request.ApplicationPath & "/Content/Images/image2.jpg"
<img src="<%= ResolveClientUrl("Content/images/image2.jpg") />

I've even used the absolute path:

<img src="" />

Nothing I do seems to display the image.  looking at the folders of C: it's:


going through IIS:

ServerName\Sites\Default Web Site\SiteName\Content\Images\image2.jpg
Who is Participating?
Steve7423Connect With a Mentor Author Commented:
I soved it !!

dang ! i was doing it wrong.  This is what it should have been.

<img src="@Url.Content("~/Content/Images/image2.jpg")" />
Are you having this problem with your published site or do you get this when testing your code.
Steve7423Author Commented:
With the published site.  everything works fine on my dev machine.  when I publish to the server that's when it fails.
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Can you simply right click on the image and copy the source the browser indicates the image is loading from ?
Steve7423Author Commented:
opening the site the image doesn't display.  I Right click the image on the main screen and here's the url path:


this is what I have in the _layout cshtml (view).  As you can see I've tried a couple different methods with no luck.

<img src="/Content/Images/image2.jpg" />

@*<img src="http://" & Request.ServerVariables("WebSvr-www1") & Request.ApplicationPath & "/Content/Images/image2.jpg"

<img src="<%= ResolveClientUrl("Content/images/image2.jpg") />*@
Steve7423Author Commented:
Someone in my office helped me find the solution.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.