日期:2014-05-17 浏览次数:20488 次
<%@ WebHandler Language="C#" Class="VerificationHandler" %>
using System;
using System.Web;
using System.Web.SessionState;
public class VerificationHandler : IHttpHandler, IRequiresSessionState
{
public void ProcessRequest (HttpContext context) {
string Verification = context.Request["Verification"].ToLower();
if (Verification != context.Session["validate_code"].ToString().ToLower()) //判断用户填写的验证码和生成的验证码是否一致,当不一致时触发的事件
{
context.Response.Write("false");
}
else
{
context.Response.Write("true");
}
}
public bool IsReusable {
get {
return false;
}
}
}