无刷新波形扭曲asp.net验证码
无刷新:也就是一般网站都有的“看不清,点击更换”、“更换验证码”的那种功能,一段js脚本搞定!
波形扭曲:类似google验证码,这个能更有效的防止验证码被机器人攻破,具体的扭曲程度可以自行设置(正弦曲线Wave扭曲图片产生波形滤镜效果),加加参数也可以改成msn的那种啊,自己举一反三吧!
彩色:字符颜色都是随机的
大小写:也是随机的,当然为了输入方便没有对大小写进行限制,也可以自己修改
1、VerifyCode.aspx.cs代码:
protected void Page_Load(object sender, EventArgs e)
{
VerifyCode v = new VerifyCode();
v.Length = this.length;
v.FontSize = this.fontSize;
v.Chaos = this.chaos;
v.BackgroundColor = this.backgroundColor;
v.ChaosColor = this.chaosColor;
v.CodeSerial = this.codeSerial;
v.Colors = this.colors;
v.Fonts = this.fonts;
v.Padding = this.padding;
string code = v.CreateVerifyCode(); //取随机码
&nb
相关文档:
FileUp.aspx 页面
1<%@ Page language="c#" Codebehind="FileUp.aspx.cs" AutoEventWireup="false" Inherits="TestCenter.FileUp" %>
2<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
3<HTML>
4 <HEAD>
5 &l ......
在Asp.Net中写了一个附件上传和下载的程序,附件上传到数据库中,然后将附件的GUID保存起来,我们可以根据GUID来找到数据库中的附件,一般附件下载的代码是:
private void Download(string ID)
{
file = logic.GetA ......
1.获取图片宽度和高度
1.您可以使用 System.Drawing.Image 类
System.Drawing.Image img = System.Drawing.Image.fromFile(Server.MapPath("example.gif"));
int width = img.Width;
int height = img.Height;
img.Dispose();
但是这里我们却不能在导入名称空间后使用 Image& ......
Bitmap srcImg = new Bitmap(300, 300); //也可以读入一张图片
Graphics graphics = Graphics.fromImage(srcImg);
Font font = new Font("宋体", 16); //字体与大小
Brush brush = new SolidBrush(Color.Red);
graphics.DrawString("www.cftea.com", font, brush, 50, 50); //写字,最后两个参数表示位置
Pen pen = ne ......