日期:2014-04-30  浏览次数:22582 次

using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Drawing;
public partial class yy_yyLogin : System.Web.UI.Page
{
//    protected void Page_Load(object sender, EventArgs e)
//    {
      
//    }
//    private string GenerateCheckCode()
//    {
//        int number;
//        char code;
//        string checkCode = String.Empty;
//        System.Random random = new Random();
//        for (int i = 0; i < 4; i++)
//        {
//            number = random.Next();
//            if (number % 2 == 0)
//                code = (char)('0' + (char)(number % 10));
//            else
//                code = (char)('A' + (char)(number % 26));
//            checkCode += code.ToString();
//        }
//        Response.Cookies.Add(new HttpCookie("CheckCode", checkCode));
//        return checkCode;
//    }
//    private void CreateCheckCodeImage(string checkCode)
//    {
//        if (checkCode == null || checkCode.Trim() == String.Empty)
//            return;
//        System.Drawing.Bitmap image = new System.Drawing.Bitmap((int)Math.Ceiling((checkCode.Length * 51.5)), 66);
//        Graphics g = Graphics.FromImage(image);
//        try
//        {
//            //生成随机生成器
//            Random random = new Random();
//            //清空图片背景色
//            g.Clear(Color.White);
//            //画图片的背景乐音线
//            for (int i = 0; i < 2; i++)
//            {
//                int x1 = random.Next(image.Width);
//                int x2 = random.Next(image.Width);
//                int y1