بچه ها من این کدو از همین سایت برداشتم
یه هندلره که قاعدتا باید عکس باینری رو از سرور بخونه بیاره ولی کار نمیکنه و علامت ضربدر میاد
ببینید مشکل کجاس؟



<%@WebHandlerLanguage="C#‎"Class="ShowImage" %>

using System;
using System.Web;
using System.Drawing;
using System.Drawing.Imaging;
using System.Data.SqlClient;
using System.IO;
using System.Configuration;
using System.Collections;
publicclassShowImage : IHttpHandler
{
publicvoid ProcessRequest(HttpContext context)
{
general g = newgeneral();
//
SqlConnection _cn = newSqlConnection(g.connectionString());
//
context.Response.ContentType = "image/jpeg";
//
context.Response.Cache.SetCacheability(HttpCacheability.NoCache);
context.Response.BufferOutput =
false;
string q = "";
// Query String
if (context.Request.QueryString["cid"] != null && context.Request.QueryString["cid"] != "")
{
// Query String
q = context.Request.QueryString["cid"].ToString();
}
// Byte Stream
System.IO.MemoryStream strm = new System.IO.MemoryStream();
try
{
//
_cn.Open();
// SQL
SqlCommand cmd = newSqlCommand("SELECT [IMAGE1] FROM [news] WHERE [ID]='" + q + "'", _cn);
// Byte
byte[] b = newbyte[0];
try
{
//
b = (byte[])cmd.ExecuteScalar();
}
catch
{
//
b = new System.Net.WebClient().DownloadData(context.Server.MapPath("images//education.jpg"));
}
finally
{
// Stream
strm.Write(b, 0, b.Length);
// Stream(byte) image
System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(strm);
// image
bmp.Save(context.Response.OutputStream, System.Drawing.Imaging.ImageFormat.Jpeg);
}
}
finally
{
//
_cn.Close();
// Stream
strm.Close();
}
}
publicbool IsReusable { get { returntrue; } }
}