protected override void OnInit(EventArgs e) { #region 获取当前程序页面地址 BasePage_CurrentURL = Request.Url.AbsoluteUri; #endregion #region 获取网站状态以决定是否运行 switch (bllConfig.ExGetConfigValue("网站状态")) { case "停止": Response.Redirect(bllConfig.ExGetConfigValue("网站维护") + "/Error.aspx"); break; default: NetName = bllConfig.ExGetConfigValue("网站名称"); break; } }//OnInit
public void ProcessRequest(HttpContext context) { string action = context.Request["action"]; switch (action) { case "newUserName": #region 修改名称 if (string.IsNullOrEmpty(context.Request["newNickName"].Trim())) { context.Response.Write("no:不能为空"); return; } if (bllUsers.GetModel(context.Request["newNickName"].Trim()) != null) { context.Response.Write("no:昵称已被占用"); return; } if (bllSensitiveLexicon.WordPattern(context.Request["newNickName"].Trim())) { context.Response.Write("no:敏感词"); return; } modelUsers = bllUsers.ExGetModel(context.Request["pastNickname"].Trim()); modelUsers.UserName = context.Request["newNickName"]; if (bllUsers.Update(modelUsers)) { context.Response.Write("ok:完成"); } else { context.Response.Write("no:更改失败"); } break; #endregion case "APPUserName": if (string.IsNullOrEmpty(context.Request["newNickName"].Trim())) { context.Response.Write("0"); return; } if (bllUsers.GetModel(context.Request["newNickName"].Trim()) != null) { context.Response.Write("0"); return; } if (bllSensitiveLexicon.WordPattern(context.Request["newNickName"].Trim())) { context.Response.Write("0"); return; } modelUsers = bllUsers.ExGetModel(context.Request["pastNickname"].Trim()); modelUsers.UserName = context.Request["newNickName"]; if (bllUsers.Update(modelUsers)) { context.Response.Write("1"); } else { context.Response.Write("0"); } break; case "NetName": try { BLL.Config bllConfig = new BLL.Config(); context.Response.Write(fastJSON.JSON.Instance.ToJSON(bllConfig.ExGetConfigValue("网站名称"))); } catch (Exception ex) { context.Response.Write("0"); } break; default: context.Response.Write("错误!13"); break; } }
public void ProcessRequest(HttpContext context) { action = context.Request["action"]; string reg = @"^[A-Za-z\d]+([-_.][A-Za-zd]+)*@([A-Za-z\d]+[-_.])+[A-Za-z\d]{2,5}$"; switch (action) { case "OKVerify": if (string.IsNullOrEmpty(context.Request["UserAccount"].Trim())) { context.Response.Write("onAccount:*账户不能为空"); return; } if (string.IsNullOrEmpty(context.Request["UserMail"].Trim())) { context.Response.Write("onMail:*邮箱不能为空"); return; } if (!Regex.IsMatch(context.Request["UserMail"].Trim(), reg)) { context.Response.Write("onMail:*输入有效的邮箱"); return; } if (string.IsNullOrEmpty(context.Request["Code"].Trim())) { context.Response.Write("onCode:*验证不能为空"); return; } if (string.IsNullOrEmpty(context.Request["ResetUserPassWord"].Trim())) { context.Response.Write("onWord:*密码不能为空"); return; } if ((string)context.Session["numberCode"] != common.MD5(common.MD5(context.Request["Code"]))) { context.Response.Write("onCode:*验证码不正确"); return; } if (!bllUsers.ExAccount(context.Request["UserAccount"])) { context.Response.Write("onAccount:*没有次用户"); return; } modelUsers = bllUsers.GetModel(context.Request["UserAccount"]); modelUsers.UserPassWord = common.MD5(common.MD5(context.Request["ResetUserPassWord"])); if (bllUsers.Update(modelUsers)) { context.Response.Write("okUrl:/Login.aspx"); } break; case "APPwrod": try { if (!Regex.IsMatch(context.Request["UserMail"].Trim(), reg)) { context.Response.Write("0"); return; } if (!bllUsers.ExAccount(context.Request["UserAccount"])) { context.Response.Write("2"); return; } modelUsers = bllUsers.GetModel(context.Request["UserAccount"]); modelUsers.UserPassWord = common.MD5(common.MD5(context.Request["ResetUserPassWord"])); if (bllUsers.Update(modelUsers)) { context.Response.Write("1"); } } catch (Exception ex) { context.Response.Write("0"); } break; case "NetName": try { BLL.Config bllConfig = new BLL.Config(); context.Response.Write(JsonConvert.SerializeObject(bllConfig.ExGetConfigValue("网站名称"))); } catch (Exception ex) { context.Response.Write("0"); } break; case "sendCode": #region 邮箱发送 string number = ""; System.Random random = new Random(); for (int i = 0; i < 5; i++) { number += (random.Next() % 10); } context.Session["numberCode"] = common.MD5(common.MD5(number)); if (bllUsers.SendCode(context.Request["UserMail"], number)) { context.Response.Write("ok"); } else { context.Response.Write("on"); } break; #endregion default: context.Response.Redirect("/Error.aspx?webPage=忘记页"); break; } }
public void ProcessRequest(HttpContext context) { action = context.Request["action"]; switch (action) { case "exit": context.Response.Cookies["VideoNetcookieLogin"].Expires = DateTime.Now.AddDays(-1); context.Session["userInfo"] = null; context.Response.Write("okexit:Login.aspx"); break; case "Register": context.Response.Write("LookVideoParticulars.aspx?f=" + common.SQLFilter(context.Request["GUID"])); break; case "GotoPage": //对列表进行分页 #region 对列表进行分页 PagePosition = context.Request["PagePosition"]; Table = common.SQLFilter(context.Request["Table"]); GUID = common.SQLFilter(context.Request["GUID"]); switch (Table) { case "Tv": context.Response.Redirect("../" + Table + "Datil.aspx?GUID=" + GUID + "&PagePosition=" + PagePosition); break; case "Article": context.Response.Redirect(Table + "Datil.aspx?PagePosition=" + PagePosition); break; default: context.Response.Write("未指定分页输出对象,请完善WebSystem.ashx中的GotoPage分支"); break; } break; #endregion case "Search": try { SearchString = common.SQLFilter(context.Request["SearchString"]); modelVideoDetail = bllVideoDetail.ExGetVideoSearchA(SearchString); ModelTemp = modelVideoDetail.GUID + "," + modelVideoDetail.VideoDetailName + "," + modelVideoDetail.VideoDetailImgeURL; context.Response.Write(ModelTemp); } catch (Exception ex) { context.Response.Write("错误!15"); } break; case "APPHomePage": try { DataTable dtTemp; DataTable dt = new DataTable(); dt.Columns.Add(new DataColumn("VideoID", typeof(string))); dt.Columns.Add(new DataColumn("VideoName", typeof(string))); dt.Columns.Add(new DataColumn("VideoCont", typeof(string))); dt.Columns.Add(new DataColumn("VideoImageURL", typeof(string))); dtTemp = bllVideoDetail.GetList(" VideoCategorGUID='" + context.Request["ID"] + "' ").Tables[0]; DataRow dr = null; foreach (DataRow row in dtTemp.Rows) { dr = dt.NewRow(); dr[0] = row["GUID"]; dr[1] = row["VideoDetailName"]; dr[2] = row["VideoDetailContent"]; dr[3] = row["VideoDetailImgeURL"]; dt.Rows.Add(dr); } List <Entity> list = new List <Entity>(); list = (from DataRow dr1 in dt.Rows select new Entity { VideoID = dr1["VideoID"].ToString(), VideoName = dr1["VideoName"].ToString(), VideoCont = dr1["VideoCont"].ToString(), VideoImageURL = dr1["VideoImageURL"].ToString() }).ToList(); context.Response.Write(Encoding.Default.GetString(Encoding.UTF8.GetBytes(fastJSON.JSON.Instance.ToJSON(list)))); } catch (Exception ex) { context.Response.Write("0"); } break; case "NetName": try { BLL.Config bllConfig = new BLL.Config(); context.Response.Write(fastJSON.JSON.Instance.ToJSON(bllConfig.ExGetConfigValue("网站名称"))); } catch (Exception ex) { context.Response.Write("0"); } break; default: context.Response.Write("错误!12"); break; } }
public void ProcessRequest(HttpContext context) { BLL.Users bllUser = new BLL.Users(); Model.Users modelUsers = new Model.Users(); string UserAccount = context.Request["UserAccount"]; string UserPassWord = common.MD5(common.MD5(common.SQLFilter(context.Request["UserPassWord"]))); action = context.Request["action"]; switch (action) { case "xxx": //此处没有在ajax中发送数据如需要用请在js中调用 int UserChckbox = Convert.ToInt32(context.Request["checkboxid"]); Code = context.Session["vCode"] != null ? context.Session["vCode"].ToString() : ""; modelUsers = bllUser.GetModel(UserAccount); if (Code == common.SQLFilter(context.Request["Code"])) { if (bllUser.CheckUserInfo(UserAccount, UserPassWord, out modelUsers)) { if (modelUsers.UsersState == 1) { context.Session["userInfo"] = modelUsers; if (UserChckbox == 1) { //将登录的用户存在cookie中 cookie.Expires = DateTime.Now.AddDays(7); cookie.Values.Add("UserAccount", UserAccount); cookie.Values.Add("UserPassWord", UserPassWord); context.Response.AppendCookie(cookie); } context.Response.Write("/HomePage.aspx"); } else { context.Response.Write("no:用户被锁定和用户异常请联系站长QQ1300646029发送账号"); } } else { context.Response.Write("no:没有此用户和以注销请联系站长QQ1300646029发送我要账号附带邮箱"); } } else { context.Response.Write("no:请先输入正确的验证码和请点击验证码刷新验证码"); } break; case "APP": try { if (bllUser.CheckUserInfo(UserAccount, UserPassWord, out modelUsers)) { if (modelUsers.UsersState == 1) { Model.PlayRight modelPlayRight = new Model.PlayRight(); BLL.PlayRight bllPlayRight = new BLL.PlayRight(); modelPlayRight = bllPlayRight.GetModel(modelUsers.UserAccount); context.Response.Write(fastJSON.JSON.Instance.ToJSON(modelUsers.UserName + "," + modelUsers.UserAccount + "," + modelPlayRight.HeadPortrait)); } else { context.Response.Write("0"); } } } catch (Exception ex) { context.Response.Write("0"); } break; case "NetName": try { BLL.Config bllConfig = new BLL.Config(); context.Response.Write(fastJSON.JSON.Instance.ToJSON(bllConfig.ExGetConfigValue("网站名称"))); } catch (Exception ex) { context.Response.Write("0"); } break; default: context.Response.Write("0"); break; } }