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

asp.net 验证码 实现

第1种.
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.Imaging;
using System.Drawing.Drawing2D;
using System.Drawing;
public partial class fetchcode : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Random rd = new Random(); //创建随机数对象
//以下4行,产生由6个字母和数字组成的一个字符串
string str = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789我你他";
string my51aspx = "";
for (int i = 0; i < 4; i++)
{
my51aspx = my51aspx + str.Substring(rd.Next(39), 1);
}
//验证码值存放到Session中用来比较
Session["Valid"] = my51aspx;
//以下三句,通过随机找一个现有图象产生一个画布Bitmap
string bgFilePath = Server.MapPath(".\\images\\bg" + new Random().Next(5) + ".jpg");//随机找个图象
// string bgFilePath = Server.MapPath(".\\images\\bg2" + ".jpg");//随机找个图象
System.Drawing.Image imgObj = System.Drawing.Image.fromFile(bgFilePath);
Bitmap newBitmap = new Bitmap(imgObj, 90, 30);//建立位图对象
Graphics g = Graphics.fromImage(newBitmap);//根据上面创建的位图对象创建绘图面
Color[] fore = { Color.Black ,Color.Red};
SolidBrush brush = new SolidBrush(fore[new Random().Next(2)]);//设置画笔颜色
//定义一个含10种字体的数组
String[] fontFamily = { "Arial", "Verdana", "Comic Sans MS", "Impact", "Haettenschweiler", "Lucida Sans Unicode", "Garamond", "Courier New", "Book Antiqua", "Arial Narrow" };
//通过循环,绘制每个字符,
for (int a = 0; a < my51aspx.Length; a++)
{
Font textFont = new Font(fontFamily[rd.Next(9)], 15, FontStyle.Regular);//字体随机,字号大小10,加粗
//每次循环绘制


相关文档:

ASP.NET AJAX 使用客户端调用服务器端的方法

  Microsoft ASP.NET AJAX可以很方便的让我们在客户端使用脚本调用ASP.NET Web
Services(.asmx),要启用这一特性,像前面提到的一样,必须要配置Web.Config,可以参照Microsoft ASP.NET
AJAX安装目录下的Web.Config,如果是通过ASP.NET AJAX-enabled Web
site模版建立的站点,则不需要再进行设置了。配置节点如下 ......

Asp.Net常用JavaScript封装(转)

using System;
      using System.Text;
      using System.Data;
      using System.Configuration;
      using System.Web;
      using System.Web.Security;
 & ......

jQuery Ajax 方法调用 Asp.Net WebService 的详细例子

http://www.cnblogs.com/TerryFeng/archive/2009/02/01/1382123.html
这很常用,搜索了一下博客园的“找找看”和谷歌,看到大部分都是转载于一两篇文章(而且来源还不是博客园),有的是简单的说一点无法运行,给初学者的调试和学习带来不方便,我在这里将jQuery Ajax 调用Aspx.Net WebService 的几个常用的方法 ......

ASP.NET客户端注册脚本汇总

第一:
          Response.Write(<script></script>);
第二:
          托一个Literal控件
          Literal(控件名).Text="<script></script>"; ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号