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

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

asp.net性能优化的几个方面

c#(或vb.net)程序改进
1、使用值类型的ToString方法
  在连接字符串时,经常使用"+"号直接将数字添加到字符串中。这种方法虽然简单,也可以得到正确结果,但是由于涉及到不同的数据类型,数字需要通过装箱操作转化为引用类型才可以添加到字符串中。但是装箱操作对性能影响较大,因为在进行这类处理时,将在托管堆中 ......

运行 ASP.NET 的进程帐户必须具有IIS 元数据库权限

问题:
用于运行 ASP.NET 的进程帐户必须具有对 IIS 元数据库(如 IIS://servername/W3SVC)的读访问权。
出现此问题多是因为先装.net framework后装IIS 造成
解决方法:
开始->程序->Microsoft .NET Framework SDK v2.0->SDK 命令提示
输入
aspnet_regiis   -i  回车
---OVER--- ......

asp.net的常用代码

 
0.用session判断是否登陆
if(Session["login"] == null)
   {
    Response.Redirect("error.aspx");
   }
1. 打开新的窗口并传送参数:
传送参数:
response.write("<script>window.open('*.aspx?id="+this.DropDownList1.SelectIndex+"&id1="+...+"')</s ......

asp.net输出 png 图像,

asp.net输出 png 32位 图像,带透明alpha。
// pngtest.htm
<html>
<head></head>
<body bgColor="gray">
<img src="png.ashx" />
</body>
</html>
//  png.ashx
<%@ WebHandler Language="C#" Class="Png" %>
using System.Web;
public class Png : IHtt ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号