Often, if the image is "not displayed" (I assume that the red-x-equivalent is displayed to display the "broken image"), I right-click on the broken image, copy the URL and open the URL in a separate browser window.
Thus, when the image is generated by some script, I see the error text that the script might show. If not, the real image will be displayed.
Also add an else block to
if (File.Exists(Server.MapPath(imagepath)))
as
else { Response.Write(string.Format( "File does not exist at '{0}'.", Server.MapPath(imagepath))); }
For debugging purposes.
Uwe keim
source share