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:
Line 66: Line 67: Line 68: Line 69: Line 70:
handler code is
<%@ WebHandler Language="C#" Class="Handler" %>
using System; using System.Web; using System.Data.SqlClient; using System.Web.Configuration; using System.Data; //Add this namespace using System.IO;
public class Handler : IHttpHandler { public void ProcessRequest (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(); } public bool IsReusable { get { return false; } }
}
how to handler this error
|
Replies
Know the answer? Post it — somebody with the same question will find it here.