Using system;
Using system. Web;
Using system. drawing;
/// <Summary>
/// Summary of PNG.
Public sealed class localpng: ihttphandler
{
# Region ihttphandler Member
Public void processrequest (httpcontext context)
{
If (context. request ["key"]! = NULL & context. request ["key"]. Length = 4) // there are numbers with an acssi Code of 1-9 and letters with a-z
{
String machine_key = context. request ["key"];
Context. response. Clear ();
Try
{// Source Image
Bitmap simage = new Bitmap (context. server. mappath ("key.png.bmp"); // image path
// Verification Code Diagram
Graphics WG = graphics. fromimage (simage );
WG. drawstring (machine_key, new font ("Comic Sans MS", 14), new solidbrush (color. royalblue), 3, 0 );
WG. Save ();
Context. response. contenttype = "image/JPEG ";
Simage. Save (context. response. outputstream, system. Drawing. imaging. imageformat. JPEG );
WG. Dispose ();
Simage. Dispose ();
}
Catch (exception E)
{Context. response. Write (E. Message );
}
Context. response. End ();
}
}
Public bool isreusable
{
Get
{
// Todo: Add codekey. isreusable getter implementation
Return false;
}
}
# Endregion
}