• 大小: 8.59MB
    文件类型: .rar
    金币: 2
    下载: 1 次
    发布日期: 2023-10-13
  • 语言: C#
  • 标签: asp.net  B/S模型  

资源简介

包含了教师在线发布作业,批改作了。学生下载作业,查询作业,用户管理,学习论坛。很完善的一个系统

资源截图

代码片段和文件信息

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 CheckCode : System.Web.UI.Page
{
    protected void Page_Load(object sender EventArgs e)
    {
        CreateImage(CreateCode());
    }

    /// 
    /// 生成随字符串
    /// 

    /// 
    private string CreateCode()
    {
        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 CreateImage(string checkCode)
    {
        if (checkCode == null || checkCode.Trim() == string.Empty)
            return;
        System.Drawing.Bitmap image = new System.Drawing.Bitmap((int)Math.Ceiling((checkCode.Length * 12.5)) 22);
        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 = random.Next(image.Height);
                int y2 = random.Next(image.Height);
                g.DrawLine(new Pen(Color.Black) x1 x2 y1 y2);
            }
            Font font = new System.Drawing.Font(“Arial“ 12(System.Drawing.Fontstyle.Bold | System.Drawing.Fontstyle.Italic));
            System.Drawing.Drawing2D.LinearGradientBrush brush = new System.Drawing.Drawing2D.LinearGradientBrush(new Rectangle(0 0 image.Width image.Height) Color.Blue Color.DarkRed 1.2f true);
            g.DrawString(checkCode font brush 2 2);
            //
            //
            //画图片的边框
            g.DrawRectangle(new Pen(Color.Silver) 0 0 image.Width - 1 image.Height - 1);
            System.IO.MemoryStream ms = new System.IO.MemoryStream();
            image.Save(ms System.Drawing.Imaging.ImageFormat.Gif);
            Response.ClearContent();
            Response.ContentType = “image/Gif“;
            Response.BinaryWrite(ms.ToArray());
        }
        finally
        {
            g.Dispose();
            image.Dispose();
        }
    }


}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件        447  2009-04-03 14:15  workmanage\CheckCode.aspx

     文件       3052  2009-04-03 16:04  workmanage\CheckCode.aspx.cs

     文件       9839  2009-05-27 10:12  workmanage\go.jpg

     文件       3543  2009-06-17 15:26  workmanage\login.aspx

     文件       3491  2009-06-13 19:22  workmanage\login.aspx.cs

     文件      52442  2009-05-27 10:13  workmanage\login.jpg

    ..A.SH.     19968  2009-06-03 11:29  workmanage\Thumbs.db

     文件       1811  2009-06-13 20:49  workmanage\Web.Config

     文件       2522  2009-05-29 18:31  workmanage\Teachers\Addstudent.aspx

     文件       2383  2009-06-11 09:52  workmanage\Teachers\Addstudent.aspx.cs

     文件       3495  2009-05-21 15:41  workmanage\Teachers\Info.aspx

     文件       1366  2009-05-21 15:44  workmanage\Teachers\Info.aspx.cs

     文件       3465  2009-06-18 10:37  workmanage\Teachers\ManageWork.aspx

     文件       6721  2009-06-14 09:40  workmanage\Teachers\ManageWork.aspx.cs

     文件       4329  2009-05-29 10:58  workmanage\Teachers\Mark.aspx

     文件       7315  2009-06-11 09:53  workmanage\Teachers\Mark.aspx.cs

     文件       4645  2009-05-19 15:15  workmanage\Teachers\PublicWork.aspx

     文件       5635  2009-06-11 09:58  workmanage\Teachers\PublicWork.aspx.cs

     文件       3075  2009-05-21 15:48  workmanage\Teachers\ResetPassword.aspx

     文件       1981  2009-06-11 09:58  workmanage\Teachers\ResetPassword.aspx.cs

     文件       4115  2009-06-08 20:01  workmanage\Teachers\Review.aspx

     文件       7811  2009-06-08 20:01  workmanage\Teachers\Review.aspx.cs

     文件       4395  2009-06-09 20:53  workmanage\Teachers\StatResult.aspx

     文件       6363  2009-06-09 20:55  workmanage\Teachers\StatResult.aspx.cs

     文件       3628  2009-06-14 09:24  workmanage\Teachers\StudentManage.aspx

     文件       6218  2009-06-14 09:24  workmanage\Teachers\StudentManage.aspx.cs

     文件       4176  2009-06-08 20:34  workmanage\Teachers\StudentSeacher.aspx

     文件       3981  2009-06-08 20:37  workmanage\Teachers\StudentSeacher.aspx.cs

     文件       1079  2009-06-05 17:06  workmanage\Teachers\teacherMainPage.aspx

     文件        425  2009-04-07 15:52  workmanage\Teachers\teacherMainPage.aspx.cs

............此处省略125个文件信息

评论

共有 条评论