My .ashx handler file contains this code but it gives ArgumentException (Parameter is not valid)
public void ProcessRequest(HttpContext context)
{
HttpRequest request = context.Request;
SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["PictureAlbumConnectionString"].ConnectionString);
string sql = "SELECT pic FROM Album WHERE Pic_ID = " + request.QueryString["id"];
SqlCommand cmd = new SqlCommand(sql, conn);
conn.Open();
byte[] bytes = (byte[])cmd.ExecuteScalar();
conn.Close();
System.Drawing.ImageConverter imageConverter = new System.Drawing.ImageConverter();
Image image = imageConverter.ConvertFrom(bytes) as Image;
System.Drawing.Bitmap b = new Bitmap(image);
b.Save(context.Response.OutputStream, ImageFormat.Jpeg);
b.Dispose();
}