我試圖在ASP.NET網頁中顯示數據庫中的圖像。我使用的是通用處理程序,它在firefox,chrome和IE9上運行良好,但在IE8中卻不行。這是我的通用處理器代碼:ASP.NET在IE8中不顯示數據庫中的圖像
public void ProcessRequest(HttpContext context)
{
byte[] FileContent = null;
if (context.Request.QueryString["imagen"] != null)
{
FileContent = GetImageFromDatabase(context.Request.QueryString["imagen"]);
context.Response.ContentType = "image/png";
context.Response.BinaryWrite(FileContent);
}
}
我和我的ASP頁面標記有一個形象:
<asp:Image ID="imgInicio" runat="server" Width="100%" AlternateText="Inicio" />
最後我把這種負載事件;
imgInicio.ImageUrl = String.Format(@"~/ShowImage.ashx?imagen={0}", idImage);
我試過了。任何幫助,將不勝感激。
你能發佈生成的HTML嗎? – 2012-02-13 22:02:24
這看起來好像不會被瀏覽器破壞。也許你有沒有在IE8中工作的CSS規則導致圖像不出現? – vcsjones 2012-02-13 22:02:45
是的,魯本斯,我寫它不好,是在這兩個地方的形象 – 2012-02-13 22:07:32