hi i m stroing & retriving image from database. i retrive image using handler than show image using gridview. but i face error
Configuration Error
Description: An error occurred during the processing
of a configuration file required to service this request. Please review
the specific error details below and modify your configuration file
appropriately.
Parser Error Message: Could not load type 'Handler'.
Source Error:
C#
Line 66:
Line 67:
Line 68:
Line 69:
Line 70:
handler code isusing System;
using System.Web;
using System.Data.SqlClient;
using System.Web.Configuration;
using System.Data; //Add this namespaceusing System.IO;
publicclassHandler : IHttpHandler {
publicvoidProcessRequest (HttpContext context) {
string constring = WebConfigurationManager.ConnectionStrings["ConnectionString1"].ConnectionString;
SqlConnection con = new SqlConnection(constring);
con.Open();
string sql = "Select image_content, type from image where image_id=@ImageId";
SqlCommand cmd = new SqlCommand(sql, myConnection);
cmd.Parameters.Add("@ImageId", SqlDbType.Int).Value = context.Request.QueryString["id"];
cmd.Prepare();
SqlDataReader dr = cmd.ExecuteReader();
dr.Read();
context.Response.ContentType = dr["type"].ToString();
context.Response.BinaryWrite((byte[])dr["image_content"]);
dr.Close();
myConnection.Close();
}
publicbool IsReusable {
get {
returnfalse;
}
}
}
how to handler this error
Answers
Know the answer? Post it. Somebody with the same question will find it here.
Answers
Know the answer? Post it. Somebody with the same question will find it here.