c#高性能在WEB端产生验证图片
来源:互联网 发布:淘宝1920海报怎么设置 编辑:程序博客网 时间:2024/05/29 17:34
导读:
using System;
using System.Web;
using System.Drawing ;
///
/// 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;
}
}
本文转自
http://study.qqcf.com/web/224/24038.htm
using System;
using System.Web;
using System.Drawing ;
///
/// 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;
}
}
本文转自
http://study.qqcf.com/web/224/24038.htm
- 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在图片写文字,产生随机验证码序列号
- Visual C#.Net网络程序开发-Tcp篇(1)
- Visual C#托管Socket的实现方法(一) (3)
- 在Visual C#中使用XML指南之读取XML
- 用C#设计在局域网发送短信的程序
- 用Visual C#实现P2P应用程序
- c#高性能在WEB端产生验证图片
- C# Builder构建Web服务和客户端
- 用C# Builder实现文件下载程序
- 用C#实现文件下载器(2)
- 用C#实现Web服务器
- 利用C#编写一个简单的抓网页应用程序
- 用C#开发网络防火墙技术分析
- 程序实现显示桌面
- 经典语录