I'm loading image from my database to temp file but my IIS can't see this file so I need to add it to my ISS somehow. I saw some way here Link So question is how to make and work with ImageHandler.dll Need I to create new dll application for it and then add to bin of my web app ?
+3
A:
You can use generic handlers for it. Here is a sample:
<%@ WebHandler Language="C#" Class="Handler" %>
using System;
using System.IO;
using System.Web;
using Deimand.Business;
using System.Configuration;
public class Handler : IHttpHandler
{
public bool IsReusable
{ get{ return false; } }
public void ProcessRequest(HttpContext context)
{
context.Response.ContentType = "image/jpeg";
if (context.Request.QueryString["imageId"] != null)
{
byte[] imageContent = GetImageFromDataBase(context.Request.QueryString["imageId"]);
context.Response.OutputStream.Write(imageContent, 0, imageContent.Length);
}
}
}
iburlakov
2010-01-19 07:59:50
thank you very much
nCdy
2010-01-19 08:24:45