login.aspx.cs
上传用户:shjujing
上传日期:2022-07-28
资源大小:11244k
文件大小:2k
源码类别:

Email客户端

开发平台:

Visual C++

  1. using System;
  2. using System.Data;
  3. using System.Configuration;
  4. using System.Collections;
  5. using System.Web;
  6. using System.Web.Security;
  7. using System.Web.UI;
  8. using System.Web.UI.WebControls;
  9. using System.Web.UI.WebControls.WebParts;
  10. using System.Web.UI.HtmlControls;
  11. using System.Data.SqlClient;
  12. public partial class login_login : System.Web.UI.Page
  13. {
  14.     BaseClass bc = new BaseClass();
  15.     protected void Page_Load(object sender, EventArgs e)
  16.     {
  17.         if (!IsPostBack)
  18.         {
  19.             Label1.Text =  new randomCode().RandomNum(4);   //产生验证码
  20.         }
  21.         //checkCode.DrawImage();
  22.     }
  23.     protected void Button1_Click(object sender, EventArgs e)
  24.     {
  25.         TextBox1.Text= TextBox1.Text;
  26.         TextBox2.Text =TextBox2.Text;
  27.         if (TextBox3.Text == "" || TextBox3.Text != Label1.Text)
  28.         {
  29.             Response.Write(bc.MessageBox("验证码不正确!"));
  30.             return;
  31.         }
  32.         if (bc.checkLogin(TextBox1.Text, TextBox2.Text) > 0)
  33.         {
  34.             //登陆成功
  35.                 Response.Write("<script language=javascript>location.href='../manage/default.aspx'</script>");
  36.                 Session["loginName"] =TextBox1.Text;
  37.         }
  38.         else
  39.         {
  40.             Response.Write(bc.MessageBox("用户名或密码错误!"));
  41.         }
  42.         //SqlConnection con = new SqlConnection(ConfigurationManager.AppSettings["conStr"]);
  43.         //SqlCommand cmd = new SqlCommand("select count(*) from tbUser where name='" + TextBox1.Text + "'and password='" + TextBox2.Text + "'", con);
  44.         //cmd.Connection.Open();
  45.         //int i = (int)cmd.ExecuteScalar();
  46.         //cmd.Connection.Close();
  47.         //if (i > 0)
  48.         //{
  49.         //    //登陆成功
  50.         //    Response.Write("<script language=javascript>location.href='../manage/default.aspx'</script>");
  51.         //    Session["loginName"] =TextBox1.Text;
  52.         //}
  53.         //else
  54.         //{
  55.         //    Response.Write(bc.MessageBox("用户名或密码错误!"));
  56.         //}
  57.         //con.Close();
  58.         
  59.     }
  60. }