验证码

 Random rad = new Random();
        int codes = rad.Next(1000, 10000);
        Session["code"] = codes;

        System.Drawing.Image newimg = System.Drawing.Image.FromFile(Server.MapPath("images/code.jpg"));
        Graphics g = Graphics.FromImage(newimg);
        g.DrawString(codes.ToString(), new Font("Arail", 14), new SolidBrush(Color.Red), 1, 1);
        newimg.Save(Response.OutputStream, System.Drawing.Imaging.ImageFormat.Jpeg);

你可能感兴趣的:(验证码)