Login.aspx.cs

(完整代码) 1KB

using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Microsoft.Practices.EnterpriseLibrary.Data;
using System.Security;
using System.Web.Security;

namespace 通用权限体系
{
    public partial class Login : System.Web.UI.Page
    {
        Database db = DatabaseFactory.CreateDatabase();

        protected void Page_Load(object sender, EventArgs e)
        {
          
        }

        protected void btnLogin_Click(object sender, EventArgs e)
        {
            string sql = string.Format("SELECT * FROM UserInfo WHERE UserName  = '{0}' AND UserPwd = '{1}'", txtBoxUserName.Text, txtBoxUserPwd.Text);

            DataSet ds = db.ExecuteDataSet(System.Data.CommandType.Text, sql);

            if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count>0)
            {
                ClientScript.RegisterClientScriptBlock(this.GetType(), "msg", "<script>alert('登录成功!');location.href='index.aspx';</script>");

                Session["LoginUserID"] = ds.Tables[0].Rows[0]["ID"];
            }
            else
            {
                ClientScript.RegisterClientScriptBlock(this.GetType(), "msg", "<script>alert('登录失败!');</script>");
            }
        }
    }
}

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

AI 解读 AI

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

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