【文件属性】:
文件名称:异步ajax验证用户名(防止重名)
文件大小:28KB
文件格式:DOC
更新时间:2014-12-01 15:56:13
ajax,异步ajax,异步ajax验证用户名
<%@ WebHandler Language="C#" Class="Handler" %>
using System;
using System.Web;
using System.Data;
using DAL;
public class Handler : IHttpHandler {
public void ProcessRequest (HttpContext context) {
context.Response.ContentType = "text/plain";
context.Response.Write("Hello World");
string username= context.Request.QueryString.Get("username");
if (username.ToString() == null || username.ToString() == "")
{
//禁止缓存
context.Response.Expires = -1;//相对过期时间
context.Response.ExpiresAbsolute = DateTime.Now.AddDays(-1);//绝对过期时间
context.Response.CacheControl = "no-cache";
context.Response.AddHeader("pragma", "no-cache");
context.Response.AddHeader("cache-control", "private");
string sql = string.Format("select * from MIS.JZG_REGISTER_TOTAL where USER_NAME='{0}'", username);
DataTable ds = DBHelper.GetDataSet(sql);
context.Response.Clear();//清除缓冲区流中所有内容
context.Response.Write("2");
context.Response.End();
}