Advertisement
Guest User

Untitled

a guest
Mar 4th, 2019
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.88 KB | None | 0 0
  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.  
  8. namespace K_JingZhan
  9. {
  10. public partial class WebForm1 : System.Web.UI.Page
  11. {
  12. protected void Page_Load(object sender, EventArgs e)
  13. {
  14.  
  15. }
  16.  
  17. protected void btnlogin_Click(object sender, EventArgs e)
  18. {
  19. String sDEFAULTUSER = "CN1801K";
  20. String sDEFAULTPWD = "Pa$$w0rd";
  21.  
  22. String sLoginId = "";
  23. String sPassword = "";
  24.  
  25. sLoginId = txtLoginId.Text;
  26. sPassword = txtPassword.Text; //22Jan19
  27.  
  28.  
  29. if (sLoginId == sDEFAULTUSER)
  30. {
  31.  
  32. if (sPassword == sDEFAULTPWD)
  33. {
  34. Response.Redirect("mainpage.aspx");
  35. }
  36. else
  37. {
  38.  
  39. }
  40. }
  41. else
  42. {
  43. lblErrorLoginId.Text = "Invalid UserId! Please try again";
  44. lblErrorPassword.Text = "Wrong Password!";
  45. }
  46.  
  47. if (sPassword.Length == 0)
  48. {
  49. lblErrorLoginId.Text = "";
  50. lblErrorPassword.Text = "Empty Password! Please try again.";
  51. }
  52. else if (sPassword.Length > 12)
  53. {
  54. lblErrorLoginId.Text = "";
  55. lblErrorPassword.Text = "The password is too long! Please try again.";
  56. }
  57. else if (sPassword.Length < 8)
  58. {
  59. lblErrorLoginId.Text = "";
  60. lblErrorPassword.Text = "The password is too short! Please try again.";
  61. }
  62. }
  63.  
  64. protected void Button2_Click(object sender, EventArgs e)
  65. {
  66. Response.Redirect("naming.aspx");
  67. }
  68. }
  69. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement