Index: src/Common/SharpMap/Web/HttpHandler.cs
===================================================================
diff -u -r8f6ae890fed8e8eae3a32f9c0498a10f82e0ddf9 -r5fc71a385897af92ccb092f2f969b5709afab85a
--- src/Common/SharpMap/Web/HttpHandler.cs (.../HttpHandler.cs) (revision 8f6ae890fed8e8eae3a32f9c0498a10f82e0ddf9)
+++ src/Common/SharpMap/Web/HttpHandler.cs (.../HttpHandler.cs) (revision 5fc71a385897af92ccb092f2f969b5709afab85a)
@@ -15,60 +15,67 @@
// along with SharpMap; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+using System.Drawing;
+using System.Drawing.Imaging;
+using System.IO;
+using System.Web;
+
namespace SharpMap.Web
{
- ///
- /// HttpHandler class for web applications
- ///
- public class HttpHandler : System.Web.IHttpHandler
- {
- #region IHttpHandler Members
+ ///
+ /// HttpHandler class for web applications
+ ///
+ public class HttpHandler : IHttpHandler
+ {
+ #region IHttpHandler Members
- ///
- /// Enable Http pooling
- ///
- public bool IsReusable
- {
- get { return true; }
- }
+ ///
+ /// Enable Http pooling
+ ///
+ public bool IsReusable
+ {
+ get
+ {
+ return true;
+ }
+ }
- ///
- /// Returns the requested image in an http imagestream
- ///
- /// HttpContext
- public void ProcessRequest(System.Web.HttpContext context)
- {
- string imgID = context.Request.QueryString["ID"];
- if (context.Cache[imgID] == null)
- {
- context.Response.Clear();
- context.Response.Write("Invalid Image requested");
- return;
- }
- if (context.Cache[imgID].GetType() == typeof(System.Drawing.Bitmap))
- {
- context.Response.ContentType = "image/png";
- System.Drawing.Bitmap b = (System.Drawing.Bitmap)context.Cache[imgID];
- // send the image to the viewer
- System.IO.MemoryStream MS = new System.IO.MemoryStream();
- b.Save(MS, System.Drawing.Imaging.ImageFormat.Png);
- // tidy up
- b.Dispose();
+ ///
+ /// Returns the requested image in an http imagestream
+ ///
+ /// HttpContext
+ public void ProcessRequest(HttpContext context)
+ {
+ string imgID = context.Request.QueryString["ID"];
+ if (context.Cache[imgID] == null)
+ {
+ context.Response.Clear();
+ context.Response.Write("Invalid Image requested");
+ return;
+ }
+ if (context.Cache[imgID].GetType() == typeof(Bitmap))
+ {
+ context.Response.ContentType = "image/png";
+ Bitmap b = (Bitmap) context.Cache[imgID];
+ // send the image to the viewer
+ MemoryStream MS = new MemoryStream();
+ b.Save(MS, ImageFormat.Png);
+ // tidy up
+ b.Dispose();
- byte[] buffer = MS.ToArray();
- context.Response.OutputStream.Write(buffer, 0, buffer.Length);
- }
- else if (context.Cache[imgID].GetType() == typeof(byte[]))
- {
- context.Response.ContentType = "image/png";
- byte[] buffer = (byte[])context.Cache[imgID];
- context.Response.OutputStream.Write(buffer, 0, buffer.Length);
- return;
- }
- context.Response.End();
- }
-
+ byte[] buffer = MS.ToArray();
+ context.Response.OutputStream.Write(buffer, 0, buffer.Length);
+ }
+ else if (context.Cache[imgID].GetType() == typeof(byte[]))
+ {
+ context.Response.ContentType = "image/png";
+ byte[] buffer = (byte[]) context.Cache[imgID];
+ context.Response.OutputStream.Write(buffer, 0, buffer.Length);
+ return;
+ }
+ context.Response.End();
+ }
- #endregion
- }
-}
+ #endregion
+ }
+}
\ No newline at end of file