Reputation: 1
I'm working on a asp.net project in Visual Studio 2012. This site is contains of download section and picture galleries. I'm using such code to show pictures added into a gallery.
string tag = "<img src=\"{0}\" width=\"64\" height=\"64\" /><br />";
addedPics.InnerHtml += string.Format(
tag, Request.Url.Authority + "/admin/pictures/" + fileName);
which results in tag like below
<img src="localhost:49179/admin/pictures/sandbox_01_ME.jpg" width="64" height="64" />
before this I used code like below in a Asp:Repeater
:
<img src="<%# Request.Url.Authority + "/admin/Pictures/" + Eval("Filename") %>"
style="float: left" width="64" height="64" />
but neither of them is working.
Any help would be appreciated.
Upvotes: 0
Views: 56
Reputation: 2739
Use a relative links in the images.
<img src="/admin/pictures/sandbox_01_ME.jpg" width="64" height="64" />
Code should be like this:
<img src="<%# "/admin/Pictures/" + Eval("Filename") %>"
style="float: left" width="64" height="64" />
When you run locally, you will have trouble trying to build the absolute URL.
Upvotes: 2