當用戶單擊我的鏈接時,它會彈出另存爲對話框,但它想要將其另存爲除IE之外的其他瀏覽器中的ashx文件。該文件是從數據庫中提取的標準jpeg。什麼會導致這樣做?ASHX圖像下載保存爲ASHX
string id = ctx.Request.QueryString["id"];
SqlConnection con = new SqlConnection();
SqlCommand cmd = new SqlCommand("EBig", con);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@EID", id);
byte[] pict = null;
ctx.Response.ContentType = "image/pjpeg";
try
{
con.Open();
pict = (byte[])cmd.ExecuteScalar();
ctx.Response.Clear();
ctx.Response.AppendHeader("content-disposition", "attachment;");
ctx.Response.ContentType = "image/pjpeg";
ctx.Response.BinaryWrite(pict);
ctx.Response.Flush();
ctx.Response.End();
}
catch
{
}
finally
{
con.Close();
}