login.aspx.cs
(完整代码) 1KBusing 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 UserCenter_login : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void ImageButton2_Click(object sender, ImageClickEventArgs e)
{
string username = this.TextBox1.Text.ToString();
string pwd = this.TextBox2.Text.ToString();
string strpwd = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(pwd.Trim(),"md5").ToString().ToLower().Substring(8,16);
SqlConnection con = DB.getcon();
string strsql = "select*from Users where UserName='"+username+"'and pwd='"+strpwd+"'";
con.Open();
SqlCommand cmd = new SqlCommand(strsql,con);
try
{
SqlDataReader dr = cmd.ExecuteReader();
if (dr.Read())
{
Session["RoleID"]=dr["RoleID"];
Session["UserName"]=dr["UserName"];
Session["UserID"]=dr["UserID"];
Response.Redirect(Request.ApplicationPath+"Front.aspx");
}
else
{
Response.Write("<script laguage='javascript'>alert('用户名或密码不正确,请重新输入!');window.location.href('login.aspx')</script>");
}
}
finally
{
con.Close();
}
}
}
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。