日期:2014-05-17 浏览次数:20557 次
<%@ WebHandler Language="C#" Class="访问者信息" %>
using System;
using System.Web;
public class 访问者信息 : IHttpHandler {
public void ProcessRequest (HttpContext context) {
context.Response.ContentType = "text/JPEG";
using(System.Drawing.Bitmap bitmap=new System.Drawing.Bitmap(200,200))
{
using(System.Drawing.Graphics g=System.Drawing.Graphics.FromImage(bitmap))
{
g.DrawString("ip:" + context.Request.UserHostAddress, new System.Drawing.Font("宋体", 20), System.Drawing.Brushes.Red, 0, 0);
g.DrawString("操作系统" + context.Request.Browser.Platform, new System.Drawing.Font("宋体", 20), System.Drawing.Brushes.Red, 0, 30);
g.DrawString("浏览器:" + context.Request.Browser.Version, new System.Drawing.Font("宋体", 20), System.Drawing.Brushes.Red, 0, 60);
}
bitmap.Save(context.Response.OutputStream, System.Drawing.Imaging.ImageFormat.Jpeg);
}
}
public bool IsReusable {
get {
return false;
}
}
}