易截截图软件、单文件、免安装、纯绿色、仅160KB

asp.net 验证码

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;
using System.Drawing.Drawing2D;
using System.Drawing.Imaging;
using System.Text;
using System.IO;
public partial class Default2 : System.Web.UI.Page
{
static readonly char[] codeList = new char[]{'0','1','2','3','4','5','6','7','8','9',
//'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z',
'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
string sessionKey = "ValidateCode";//保存在Session中所用的KEY
int codeLength = 5; //验证码字符长度
int width = 80; //验证码图片宽度
int height = 20; //验证码图片高度
int fontSize = 14; //验证码字体大小
protected void Page_Load(object sender, EventArgs e)
{
//获取验证码字符串
string strCode = GetValidateCode();
//将验证码字符串保存到Session中
Session[sessionKey] = strCode;
//实例化图片
using (Bitmap img = new Bitmap(width, height))
{
//获取画板
using (Graphics g = Graphics.fromImage(img))
{
g.Clear(Color.White);
Random random = new Random();
//画图片的背景噪音线
for (int i = 0; i < 15; i++)
{
int x1 = random.Next(width);
int x2 = random.Next(width);
int y1 = random.Next(height);
int y2 = random.Next(height);
g.DrawLine(new Pen(Color.Silver), x1, y1, x2, y2);
}


相关文档:

使用ASP.NET上传图片汇总

1 使用标准HTML来进行图片上传
前台代码:
<body> 
    <form id="form1" runat="server"> 
    <div> 
        <table> 
       &nbs ......

asp.net 读取Xml文件并进行DropDownList数据绑定

<asp:DropDownList ID="compactType" runat="server" AutoCallBack="True" Width="153px"> </asp:DropDownList>

<?xml version="1.0" encoding="utf-8" ?>
<roots>
<root>
<id>1</id>
<Culture> ......

用C#(ASP.NET)怎么实现文件下载功能

using System;
using System.Data;
using System.Configuration;
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.IO;
public partial class _Default : Syste ......

ASP.NET AJAX 服务器端编程学习小结

    最近开始了ASP.NET AJAX的全面学习。在服务端编程这块主要有几个服务器控件负责,他们分别为:ScriptManager,Timer,UpdatePanel,UpdateProgress.
     先来说说ScriptManager.它有个方法registerAsyncPostBackControl(控件),可以注册页面上的任何控件为异步传送按钮。还有个方法叫 ......

asp.net c# 数据库备份

protected void btnsearch_ServerClick(object sender, EventArgs e)
    {
        string lujing=this.Text2.Value.ToString().Trim();
        string shujuku = this.jine.Value;
      &nbs ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号