Steve7423
asked on
ASP.net 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/image 2.jpg" />
<img src="/../Content/Images/im age2.jpg" />
<img src="../Content/Images/ima ge2.jpg" />
<img src="http://" & Request.ServerVariables("M yServer") & Request.ApplicationPath & "/Content/Images/image2.jp g"
<img src="<%= ResolveClientUrl("Content/ images/ima ge2.jpg") />
I've even used the absolute path:
<img src="www.websitename.com/Content/Images/image2.jpg" />
Nothing I do seems to display the image. looking at the folders of C: it's:
C:\inetpub\wwwroot\SiteNam e\Content\ Images\ima ge2.jpg
going through IIS:
ServerName\Sites\Default Web Site\SiteName\Content\Imag es\image2. jpg
<img src="/Content/Images/image
<img src="/../Content/Images/im
<img src="../Content/Images/ima
<img src="http://" & Request.ServerVariables("M
<img src="<%= ResolveClientUrl("Content/
I've even used the absolute path:
<img src="www.websitename.com/Content/Images/image2.jpg" />
Nothing I do seems to display the image. looking at the folders of C: it's:
C:\inetpub\wwwroot\SiteNam
going through IIS:
ServerName\Sites\Default Web Site\SiteName\Content\Imag
Are you having this problem with your published site or do you get this when testing your code.
ASKER
With the published site. everything works fine on my dev machine. when I publish to the server that's when it fails.
Can you simply right click on the image and copy the source the browser indicates the image is loading from ?
ASKER
opening the site the image doesn't display. I Right click the image on the main screen and here's the url path:
http://WebSvr-www1/Content/Images/image2.jpg
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/image 2.jpg" />
@*<img src="http://" & Request.ServerVariables("W ebSvr-www1 ") & Request.ApplicationPath & "/Content/Images/image2.jp g"
<img src="<%= ResolveClientUrl("Content/ images/ima ge2.jpg") />*@
http://WebSvr-www1/Content/Images/image2.jpg
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/image
@*<img src="http://" & Request.ServerVariables("W
<img src="<%= ResolveClientUrl("Content/
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Someone in my office helped me find the solution.