// Verify the code using system; use system.drawing; using system.drawing.imaging;
Namespace alumini.manage {///
Private void validatecode (string vnum) {INT GHEIGHT = (int)); // Gheight For the image width, automatically change image width system.drawing.bitmap img = new system.drawing.bitmap according to character length GHEIGHT, 20); Graphics g = graphics.fromimage (img); g.drawstring (vnum, new system.drawing.font ("arial", 10), new system.drawing.solidbrush (Color.red), 3, 3 ); // Draw strings in the rectangular shape (string, font, brush color, on the left X.- Y) system.io.MemoryStream ms = new system.io.MemoryStream (); img.save (ms, system.drawing .Imaging.imageformat.png); response.clearContent (); // Need to output image information To modify http head Response.contentType = "image / png"; response.binaryWrite (ms.toarray ()); g.dispose ); Img.dispose (); response.end ();}
public string RndNum (int VcodeNum) {string chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; Random rand = new Random ();; string VNum = ""; int l = 0 for (int i = 1; i