Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Web;
- using System.Web.UI;
- using System.Web.UI.WebControls;
- namespace K_JingZhan
- {
- public partial class WebForm1 : System.Web.UI.Page
- {
- protected void Page_Load(object sender, EventArgs e)
- {
- }
- protected void btnlogin_Click(object sender, EventArgs e)
- {
- String sDEFAULTUSER = "CN1801K";
- String sDEFAULTPWD = "Pa$$w0rd";
- String sLoginId = "";
- String sPassword = "";
- sLoginId = txtLoginId.Text;
- sPassword = txtPassword.Text; //22Jan19
- if (sLoginId == sDEFAULTUSER)
- {
- if (sPassword == sDEFAULTPWD)
- {
- Response.Redirect("mainpage.aspx");
- }
- else
- {
- }
- }
- else
- {
- lblErrorLoginId.Text = "Invalid UserId! Please try again";
- lblErrorPassword.Text = "Wrong Password!";
- }
- if (sPassword.Length == 0)
- {
- lblErrorLoginId.Text = "";
- lblErrorPassword.Text = "Empty Password! Please try again.";
- }
- else if (sPassword.Length > 12)
- {
- lblErrorLoginId.Text = "";
- lblErrorPassword.Text = "The password is too long! Please try again.";
- }
- else if (sPassword.Length < 8)
- {
- lblErrorLoginId.Text = "";
- lblErrorPassword.Text = "The password is too short! Please try again.";
- }
- }
- protected void Button2_Click(object sender, EventArgs e)
- {
- Response.Redirect("naming.aspx");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement