最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
Ajax邮箱、用户名唯一性验证实例代码
时间:2022-06-25 14:18:12 编辑:袖梨 来源:一聚教程网
废话不多说了,直接给大家贴代码了,具体代码如下所示:
reg.ashx代码:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace WebT1.Ti.html2
{
///
/// reg 的摘要说明
///
public class reg : IHttpHandler
{
public void ProcessRequest(HttpContext context)
{
if (context.Request["email"] != null)
{
string strEmail = context.Request["email"];
List lstUser = DataService.GetUserList();
var v = lstUser.Where(p => p.Email == strEmail);
int iCount = 0;
if (v.Count() > 0)
{
iCount = 1;
}
context.Response.ContentType = "text/plain";
context.Response.Write(iCount.ToString());
}
}
public bool IsReusable
{
get
{
return false;
}
}
}
public class DataService
{
///
/// 模拟已注册用户数据
///
public static List GetUserList()
{
var list = new List();
list.Add(new UserModel() { Email = "[email protected]" });
list.Add(new UserModel() { Email = "[email protected]" });
list.Add(new UserModel() { Email = "[email protected]" });
list.Add(new UserModel() { Email = "[email protected]" });
list.Add(new UserModel() { Email = "[email protected]" });
return list;
}
}
public class UserModel
{
public string Email { get; set; }
}
}
相关文章
- 女神漫画免费在线阅读入口-女神漫画全集免费畅读 02-15
- 绝区零官方云游戏入口在哪-绝区零云游戏在线畅玩入口 02-15
- 智慧团建手机登录入口在哪进-网上共青团智慧团建官网入口 02-15
- 歪歪漫画秋蝉官方入口-秋蝉漫画免费下拉式阅读直达链接 02-15
- 歪漫科技无删减漫画最新版本下载-搜索到的不一定能看官方入口 02-15
- 企查查企业查询官网直达-企查查网页版一键查询 02-15