how to remove mention error.
Server Error in '/' Application.
Parser Error
Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately. Parser Error Message: Could not create type 'OCMS.ImageHandler'. Source Error:
Line 1: <%@ WebHandler Language="C#" CodeBehind="ImageHandler.ashx.cs" Class="OCMS.ImageHandler" %>
|
Source File: /ImageHandler.ashx Line: 1
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.8.4330.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data.SqlClient;
namespace OCMS
{
/// <summary>
/// Summary description for ImageHandler
/// </summary>
public class ImageHandler : IHttpHandler
{
public void ProcessRequest(HttpContext context)
{
string imageId = context.Request.QueryString["Id"].ToString();
SqlConnection con = new SqlConnection(@"Data Source=(localdb)\Projects;Initial Catalog=OCMS;Integrated Security=True;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False");
SqlCommand cmd = new SqlCommand("select Image from IT_comp_box where COMP_ID=" + imageId, con);
con.Open();
SqlDataReader dr = cmd.ExecuteReader();
dr.Read();
context.Response.BinaryWrite((Byte[])dr[0]);
context.Response.ContentType = "image/jpg";
context.Response.End();
}
public bool IsReusable
{
get
{
return false;
}
}
}
}