<%@ WebHandler Language="C#" Class="Handler" %>
using System;
using System.IO;
using System.Web;
public class Handler : IHttpHandler {
public bool IsReusable {
get {
return true;
}
}
public void ProcessRequest (HttpContext context) {
context.Response.ContentType = "image/jpeg";
context.Response.Cache.SetCacheability(HttpCacheability.Public);
context.Response.BufferOutput = false;
try
{
string sno = context.Request.QueryString["sno"];
byte[] buffer = GetPhoto(sno);
if (buffer != null)
{
context.Response.OutputStream.Write(buffer, 0, buffer.Length);
}
else
{
context.Response.WriteFile("Images/nophoto.jpg");
}
}
catch (Exception ex){
context.Response.Write(ex);
}
}
}
using System;
using System.IO;
using System.Web;
public class Handler : IHttpHandler {
public bool IsReusable {
get {
return true;
}
}
public void ProcessRequest (HttpContext context) {
context.Response.ContentType = "image/jpeg";
context.Response.Cache.SetCacheability(HttpCacheability.Public);
context.Response.BufferOutput = false;
try
{
string sno = context.Request.QueryString["sno"];
byte[] buffer = GetPhoto(sno);
if (buffer != null)
{
context.Response.OutputStream.Write(buffer, 0, buffer.Length);
}
else
{
context.Response.WriteFile("Images/nophoto.jpg");
}
}
catch (Exception ex){
context.Response.Write(ex);
}
}
}