login.aspx.cs
资源名称:yjal.rar [点击查看]
上传用户:shjujing
上传日期:2022-07-28
资源大小:11244k
文件大小:2k
源码类别:
Email客户端
开发平台:
Visual C++
- using System;
- using System.Data;
- using System.Configuration;
- using System.Collections;
- using System.Web;
- using System.Web.Security;
- using System.Web.UI;
- using System.Web.UI.WebControls;
- using System.Web.UI.WebControls.WebParts;
- using System.Web.UI.HtmlControls;
- using System.Data.SqlClient;
- public partial class login_login : System.Web.UI.Page
- {
- BaseClass bc = new BaseClass();
- protected void Page_Load(object sender, EventArgs e)
- {
- if (!IsPostBack)
- {
- Label1.Text = new randomCode().RandomNum(4); //产生验证码
- }
- //checkCode.DrawImage();
- }
- protected void Button1_Click(object sender, EventArgs e)
- {
- TextBox1.Text= TextBox1.Text;
- TextBox2.Text =TextBox2.Text;
- if (TextBox3.Text == "" || TextBox3.Text != Label1.Text)
- {
- Response.Write(bc.MessageBox("验证码不正确!"));
- return;
- }
- if (bc.checkLogin(TextBox1.Text, TextBox2.Text) > 0)
- {
- //登陆成功
- Response.Write("<script language=javascript>location.href='../manage/default.aspx'</script>");
- Session["loginName"] =TextBox1.Text;
- }
- else
- {
- Response.Write(bc.MessageBox("用户名或密码错误!"));
- }
- //SqlConnection con = new SqlConnection(ConfigurationManager.AppSettings["conStr"]);
- //SqlCommand cmd = new SqlCommand("select count(*) from tbUser where name='" + TextBox1.Text + "'and password='" + TextBox2.Text + "'", con);
- //cmd.Connection.Open();
- //int i = (int)cmd.ExecuteScalar();
- //cmd.Connection.Close();
- //if (i > 0)
- //{
- // //登陆成功
- // Response.Write("<script language=javascript>location.href='../manage/default.aspx'</script>");
- // Session["loginName"] =TextBox1.Text;
- //}
- //else
- //{
- // Response.Write(bc.MessageBox("用户名或密码错误!"));
- //}
- //con.Close();
- }
- }