<%@ WebHandler Language="C#" Class="GenericHandler1" %>
using System;
using System.Web;
using System.Data;
using System.Data.SqlClIEnt;
//萬雅虎(biwenwan2007版權所有..........)
//如果有問題請聯系作者:vipwan#sina.com.....
//轉載請注明出處.謝謝!
public class GenericHandler1 : IHttpHandler {
const int BUFFERSIZE = 1024;
public bool IsReusable {
get {
return false ;
}
}
public void ProcessRequest(HttpContext context)
{
context.Response.ContentType = "image/jpeg";
context.Response.Cache.SetCacheability(HttpCacheability.Public);
context.Response.BufferOutput = false ;
//調用寫圖片的方法,並且傳入參數/
string IMGID = context.Request.QueryString.Get("IMGID");
System.IO.Stream _stream = context.Response.OutputStream;
if (_stream == null)
{
throw new Exception("還沒有傳入參數嗎?! Error!!!!");
}
else
{
writeSingleImage(IMGID, _stream);
}
context.Response.End();
}
private void writeSingleImage(string _IMGID, System.IO.Stream _output)
{
// connDatabase co = new connDatabase();