PageRenderTime 44ms CodeModel.GetById 20ms RepoModel.GetById 0ms app.codeStats 0ms

/website/control/UserControl.ashx.cs

https://github.com/panmingzhi815/SchoolManagementSystem
C# | 85 lines | 71 code | 11 blank | 3 comment | 6 complexity | ca3d900f1b0255fcf868a5d7eacccfc8 MD5 | raw file
Possible License(s): LGPL-2.1
  1. using System;
  2. using System.Collections;
  3. using System.Data;
  4. using System.Linq;
  5. using System.Web;
  6. using System.Web.Services;
  7. using System.Web.Services.Protocols;
  8. using System.Xml.Linq;
  9. using System.Web.SessionState;
  10. namespace Domain.control
  11. {
  12. /// <summary>
  13. /// Summary description for $codebehindclassname$
  14. /// </summary>
  15. [WebService(Namespace = "http://tempuri.org/")]
  16. [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
  17. public class UserControl : IHttpHandler, IRequiresSessionState
  18. {
  19. public HttpContext context;
  20. public void ProcessRequest(HttpContext context)
  21. {
  22. this.context = context;
  23. context.Response.ContentType = "text/plain";
  24. string method = context.Request.QueryString.Get("method");
  25. switch (method) {
  26. case "createUser":
  27. createUser();
  28. break;
  29. case "updateUser":
  30. updateUser();
  31. break;
  32. case "deleteUser":
  33. deleteUser();
  34. break;
  35. case "login" :
  36. login();
  37. break;
  38. default :
  39. context.Response.Write("-1");
  40. return;
  41. }
  42. }
  43. public bool IsReusable
  44. {
  45. get
  46. {
  47. return false;
  48. }
  49. }
  50. public void createUser()
  51. {
  52. }
  53. public void updateUser()
  54. {
  55. }
  56. public void deleteUser()
  57. {
  58. }
  59. public void login()
  60. {
  61. string username = context.Request.QueryString.Get("username");
  62. string password = context.Request.QueryString.Get("password");
  63. if (username == "admin" && password == "admin")
  64. {
  65. context.Session.Add("username", username);
  66. context.Session.Add("password", password);
  67. context.Response.Write("1");
  68. }
  69. else {
  70. context.Response.Write("0");
  71. }
  72. }
  73. }
  74. }