画像をバイト配列として SQL Server データベースに保存し、ハンドラーを使用して画像を Web ページに表示しています。画像は Internet Explorer では正常に表示されますが、chrome や firefox では一部、奇妙な文字が表示されます。
お気に入り
ÿØÿáExifII*ÿìDuckyPÿáohttp://ns.adobe.com/xap/1.0/ ÿíHPhotoshop 3.08BIMZ%G8BIM%üá‰È·Éx/4b4XwëÿîAdobedÀÿÛ
ハンドラの私のコードは
if (context.Request.QueryString["id"] != null)
{
// context.Response.Write(context.Request.QueryString["id"]);
string dbcon = ConfigurationManager.ConnectionStrings["CS1"].ConnectionString;
SqlConnection con = new SqlConnection(dbcon);
con.Open();
SqlCommand cmd = new SqlCommand("select Offers_bigimage from Offers where Offers_OfferId=@empid", con);
cmd.Parameters.AddWithValue("@empid", context.Request.QueryString["id"].ToString());
SqlDataReader dr = cmd.ExecuteReader();
dr.Read();
context.Response.BinaryWrite((byte[])dr["Offers_bigimage"]);
dr.Close();
con.Close();
}
else
{
context.Response.Write("No Image Found");
}
助けてください