最新下载
热门教程
- 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"]; ListlstUser = 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 ListGetUserList() { 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; } } }
相关文章
- PS磨皮教程 欧美人像超质感磨皮教程 07-13
- Dreamweaver2018怎么快速插入文本框? 07-13
- 魔兽世界净化水体怎么做-净化水体任务攻略 07-13
- 微信抽签活动粉丝增长案例之一周增长五万粉丝 07-13
- 夕阳西下的唯美句子 07-13
- 怎么用PS制作改变照片视觉效果? 07-13