Guest User

Untitled

a guest
Feb 12th, 2019
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.33 KB | None | 0 0
  1. protected void Submit_Click(object sender, EventArgs e)
  2. {
  3.  
  4. //assign text from the textboxes to variables
  5. string userName = TextBox1.Text;
  6. string passWord = TextBox2.Text;
  7.  
  8. lblError.Visible = true;
  9.  
  10. try
  11. {
  12.  
  13. string passwordValue = Encrypt(passWord);
  14.  
  15. DataSet1.tblUserDataTable dataTable = proccessedProcess.Login(userName, passwordValue);
  16.  
  17. if (dataTable != null & dataTable.Count!=0)
  18. {
  19. DataSet1.tblUserRow dataRow = dataTable[0];
  20. if (dataRow.nUserID.ToString() == "00000000-0000-0000-0000-000000000000")
  21. {
  22. lblError.Text = "";
  23.  
  24. }
  25.  
  26. else if(dataRow.nUserID.ToString() != "00000000-0000-0000-0000-000000000000")
  27. {
  28. Session["CurrentUserID"] = dataRow.nUserID.ToString();
  29. Session["LoggedIn"] = "YES";
  30. Session["LastLogin"] = DateTime.Now.ToString();
  31. Session["UserName"] = dataRow.txtUserName;
  32.  
  33. HttpContext.Current.Response.Redirect("MainCustomer.aspx");
  34.  
  35. }
  36. } else {
  37.  
  38.  
  39. lblError.Text = "Incorrect UserID or Password";
  40.  
  41. }
  42.  
  43. }
  44.  
  45. catch (Exception E)
  46. {
  47. E.Message.ToString();
  48. lblError.Text = E.Message;
  49.  
  50. }
  51.  
  52.  
  53. }
  54.  
  55. catch (Exception E)
  56. {
  57. // E.Message.ToString();
  58. Throw;
  59. }
Add Comment
Please, Sign In to add comment