My Photo
Name:
Location: United States

Friday, May 25, 2007

Retreive images thru ASHX (IHttpHandler)

<br />contents of NWEmpPhoto.ashx<br /><%@ webhandler language="C#" class="NWEmpPhotoHandler" %><br />using System;<br />using System.Web;<br />using System.Data;<br />using System.Data.SqlClient;<br />public class NWEmpPhotoHandler : IHttpHandler {<br />public bool IsReusable { get { return true; } }<br />public void ProcessRequest(HttpContext ctx) {<br /><br />ctx.Response.ContentType = "image/bmp";<br />ctx.Response.OutputStream.Write(pict, 78, pict.Length - 78);<br />}<br />}<br /><img src="NWEmpPhoto.ashx?id=1" /><br /><br />

0 Comments:

Post a Comment

<< Home