Login.aspx.cs

(开头部分) 2KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

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;

/// <summary>
/// 系统登录页面
/// </summary>
public partial class Login : System.Web.UI.Page
{
    private readonly string ConnectionString = ConfigurationManager.AppSettings["ConnectionString"].ToString();
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            Session["Admin"] = this.TextBox1.Text.Trim();
        }
			
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
      //创建连接字符串

        if (this.DropDownList1.SelectedValue == "管理员")
        {
            if (this.TextBox1.Text != "admin")
            {
                this.LabelMsg.Text = "用户名错误!";
                return;
            }
        }

        string sqlstr;
            sqlstr = "select Pwd from tb_User where UserName=@adminname";
            SqlConnection scon = new SqlConnection(ConnectionString);
            SqlCommand scm = new SqlCommand(sqlstr, scon);
            scm.Parameters.Add("@adminname", SqlDbType.VarChar, 20);
            scm.Parameters["@adminname"].Value = this.TextBox1.Text.Trim();
            scon.Open();
            SqlDataReader reader = scm.ExecuteReader();
            if (reader.Read())
            {

                string strPwd = reader[0].ToString();

                reader.Close();
                if (strPwd != TextBox2.Text.Trim())
                {
                    this.LabelMsg.Text = "密码错误!";
                }
                else
                {
                    Session["js"] = this.DropDownList1.SelectedValue;
后面还有 19 行代码,购买后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。