Login.aspx.cs 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Web;
  5. using System.Web.UI;
  6. using System.Web.UI.WebControls;
  7. namespace LYFZ.WanYuKeFu
  8. {
  9. public partial class Login : System.Web.UI.Page
  10. {
  11. protected void Page_Load(object sender, EventArgs e)
  12. {
  13. if (LYFZ.Command.Command_Session.GetObject("User") != null)
  14. {
  15. Response.Redirect(@"~\admin\index.html");
  16. }
  17. else
  18. {
  19. if (Request.QueryString["login"] != null)
  20. {
  21. string name = Request.Form["name"];
  22. string password = Request.Form["password"];
  23. LYFZ.WanYuKeFuData.DAL.User userDal = new LYFZ.WanYuKeFuData.DAL.User(Global.DbConn);
  24. LYFZ.WanYuKeFuData.Model.User retUser = userDal.GetUser(name);
  25. if (retUser.ID > 0)
  26. {
  27. if (LYFZ.WinAPI.SDKSecurity.MD5Encrypt(password).ToLower() == retUser.Password.ToLower())
  28. {
  29. LYFZ.Command.Command_Session.AddObject("User", retUser, 600);
  30. Response.Redirect(@"~\Login.aspx");
  31. }
  32. else
  33. {
  34. Response.Write("<script type=\"text/javascript\" >alert('用户名或密码不正匹配');window.location.assign(\"/login/index.html\")</script>");
  35. }
  36. }
  37. else
  38. {
  39. Response.Write("<script type=\"text/javascript\" >alert('用户名或密码不正确');window.location.assign(\"/login/index.html\")</script>");
  40. }
  41. }
  42. else
  43. {
  44. Response.Redirect(@"~\login\index.html");
  45. }
  46. }
  47. }
  48. }
  49. }