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

asp.net验证码

using System.Drawing;
using System.Drawing.Drawing2D;
类:
/// <summary>
/// 生成验证码
/// </summary>
private void DrowCode()
{
Response.Cache.SetNoStore();
System.Drawing.Bitmap image = new System.Drawing.Bitmap(77, 20);
Graphics g = Graphics.fromImage(image);
Color[] borders = new Color[10] { Color.AliceBlue, Color.Aqua, Color.Black, Color.Brown, Color.DarkRed, Color.SkyBlue, Color.Silver, Color.Tan, Color.Violet, Color.SpringGreen };
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.Silver), x1, y1, x2, y2);
}
string str = "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";
string[] codes = str.Split(',');
string serial = string.Empty;
for (int i = 0; i < 6; i++) // i 控制验证码字符个数
{
serial += codes[random.Next(codes.Length)];
}
Font font = new System.Drawing.Font("Verdana", 11, System.Drawing.FontStyle.Bold);
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(serial, font, brush, random.Next(image.Width - 77), random.Next(image.Height - 20));
//画图片的前景噪音点
for (int i = 0; i < 50; i++)
{
int x = random.Next(image.Width);
int y = random.Next(image.Height);
image.SetPixel(x, y,


相关文档:

asp.net 2.0注册iis 无法显示该页

有时候用iis配置的网站,总是出现无法显示该页的提示
出现这种问题的原因有多种,具体是哪种,总也搞不大明白,不过,每次去解决这个问题的时时候,
总会想到这个方法:
就是.net 重新注册iis
操作是:
1.在“开始”--“运行”中命令提示符下 输入“cd C:\WINDOWS\Microsoft.NET\Framework\ ......

如何打开别人的ASP.net项目

[转载]如何打开别人的ASP.net项目
如何打开别人的ASP.net项目2006-2-24 21:51:00
  (1)将项目文件夹拷贝到你机器的wwwroot目录
   (2)在IIS建立一个名称为WebApplication的虚拟目录,主目录设定为 C:\Inetpub\wwwroot            ......

ASP.NET跨页面传值技巧总结

关于页面传值的方法,引发了很多讨论。看来有很多人关注这个,我就我个人观点做了些总结,希望对大家有所帮助。
1.  使用QueryString变量
QueryString是一种非常简单的传值方式,他可以将传送的值显示在浏览器的地址栏中。如果是传递一个或多个安全性要求不高或是结构简单的数值时,可以使用这个方法。但是对于传递 ......

从ASP.NET应用程序生存周期谈起(2)

  那么通过以上的说明,问题二:我们怎么知道IIS和ASP.NET ISAPI到底是怎样工作的?
ASP.NET Process Model之一:IIS 和 ASP.NET ISAPI
前几天有一个朋友在MSN上问我“ASP.NET 从最初的接收到Http request到最终生成Response的整个流程到底是怎样的?”我觉得这个问题涉及到IIS和ASP.NETASP.NET Runt ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号