예제 #1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     Globals.formTitle = "Sign In";
     Globals.subTitle = "Please complete the Sign In form below for downloading";
     Globals.vContent = string.Empty;
     if (IsPostBack)
     {
         bool isDownload = true;
         Globals.vContent = string.Empty;
          string password = Request.Form["password"];
         if (password.Length ==0)
         {
             Globals.vContent += "<li>Password is not valid</li>";
             isDownload = false;
             return;
         }
         string username = Request.Form["username"];
         if (username.Length == 0)
         {
             Globals.vContent += "<li>username is not valid</li>";
             isDownload = false;
             return;
         }
         wUser user = new wUser();
         user.Username = username;
         user.Password = password;
         if (!user.Login())
         {
             Globals.vContent += "<li>Username is not correct or password is wrong!!!</li>";
             isDownload = false;
             return;
         }
         if (isDownload)
         {
             //FormsAuthentication.SetAuthCookie(username, false);
             //FormsAuthenticationTicket fat = new FormsAuthenticationTicket(1,
             //username, DateTime.Now,
             //DateTime.Now.AddMinutes(10), false, "member",
             //FormsAuthentication.FormsCookiePath);
             //Response.Cookies.Add(new HttpCookie(FormsAuthentication.FormsCookieName,
             //    FormsAuthentication.Encrypt(fat)));
             wUser.currentUser = user;
             Response.Redirect("DownloadSuccess.aspx");
         }
     }
 }
예제 #2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         wUser user = new wUser();
         user.Username = Request.Form["username"];
         user.Password = Request.Form["password"];
         if (user.Login())
         {
             Response.Write("SUCCESS");
         }
         else
         {
             Response.Write("FAIL");
         }
     }
     catch
     {
         Response.Write("FAIL");
     }
 }