【转贴收藏】c#高性能在WEB端产生验证图片
来源:互联网 发布:软件项目过程 编辑:程序博客网 时间:2024/09/21 09:01
using System;
using System.Web;
using System.Drawing ;
/// <summary>
/// Png 的摘要说明。
public sealed class LocalPng:IHttpHandler
{
#region IHttpHandler 成员
public void ProcessRequest(HttpContext context)
{
if(context.Request["key"]!=null&&context.Request["key"].Length ==4)//还有ACSSI码是1-9的数字和a-z的字母
{
string machine_key=context.Request["key"];
context.Response.Clear();
try
{ //原图
Bitmap sImage = new Bitmap(context.Server.MapPath("key.png.bmp")); //图片路径
//验证码图
Graphics wg = Graphics.FromImage(sImage);
wg.DrawString(machine_key,new Font("Comic Sans MS",14),new SolidBrush(Color.RoyalBlue),3,0);
wg.Save();
context.Response.ContentType = "image/Jpeg";
sImage.Save(context.Response.OutputStream,System.Drawing.Imaging.ImageFormat.Jpeg);
wg.Dispose();
sImage.Dispose();
}
catch(Exception e)
{context.Response.Write(e.Message);
}
context.Response.End();
}
}
public bool IsReusable
{
get
{
// TODO: 添加 CodeKey.IsReusable getter 实现
return false;
}
}
#endregion
}
- 【转贴收藏】c#高性能在WEB端产生验证图片
- c#高性能在WEB端产生验证图片
- c#高性能在WEB端产生验证图片
- c#高性能在WEB端产生验证图片
- c#高性能在WEB端产生验证图片
- 图片验证码c#产生
- C# 产生验证码图片
- WEB Service产生随机验证码图片
- Java web 产生随机图片验证码
- C#中产生验证码图片
- 随机验证图片的产生,asp.net 2.0 c# ---在网页的特定或莫个位置显示图片
- 高性能web开发 - 图片篇
- 高性能WEB开发 - 图片篇
- 高性能WEB开发之图片篇
- 高性能WEB开发 - 图片篇
- 高性能WEB开发 - 图片篇
- 高性能WEB开发 - 图片篇
- python在图片写文字,产生随机验证码序列号
- 全国城市汽车牌照一览表!
- 体贴男人的食品
- 亲密接触VC6.0编译器
- 经典诗词
- 用什么来开发ASP.NET?
- 【转贴收藏】c#高性能在WEB端产生验证图片
- QDriver一个设计驱动的数据访问层自动化工具
- 辛弃疾词全集(92首)
- 苏轼词选(48首)
- Eclipse3.1 + jboss3.2.6 +lomboz3.1+Tomcat5.0.24配置的一些经验
- [转帖]Illustrator 巧制透明按钮
- 【教程】点燃一支蜡烛的过程-PS的写实方法
- 初闯Blog
- Adobe Illustrater绘制萝卜