易截截图软件、单文件、免安装、纯绿色、仅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);
}


相关文档:

iis6解决运行asp.net mvc

配置iis6解决运行asp.net mvc项目“无法找到该页”的错误
在iis6运行asp.net mvc 项目时,如果出现“无法找到该页”的提示,即404错误,那么有可能是iis没有设置好,按下面操作可以解决:
打开iis管理器,右击相应的网站节点,选择“属性”快捷菜单,弹出属性对话框,选择“主目录&rd ......

ASP.net连接数据库实现图片轮换

前台代码:
 <script type="text/javascript">
  <%=LoadImage() %>
imgUrl1="uploads/"+ImgSrc[0];
imgtext1=ImgAlt[0]
imgLink1=escape("adimg.aspx?Img_ID="+ImgUrl[0]);
imgUrl2="uploads/"+ImgSrc[1];
imgtext2=ImgAlt[1]
imgLink2=escape("adimg.aspx?Img_ID="+ImgUrl[1]);
imgUrl3=" ......

"序列化" Serializable 理解 (asp.net C#)

 比如用一个类描述一张合同,而这个类实例化后其中的字段保存着合同的信息,如果现在要把这个类的实例发送到另一台机器、另一个窗体或是想保存这个类以便以后再取出来用(持久化对象),可以对这个类进行序列化(序列化实际上是一个信息流),传送或保存,用的时候再反序列化重新生成这个对象
为什么您想要使用序列化 ......

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

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

asp.net 4种事务


<!--
/* Font Definitions */
@font-face
{font-family:宋体;
panose-1:2 1 6 0 3 1 1 1 1 1;
mso-font-alt:SimSun;
mso-font-charset:134;
mso-generic-font-family:auto;
mso-font-pitch:variable;
mso-font-signature:3 135135232 16 0 262145 0;}
@font-face
{font-family:"Cambria Mat ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号