📄 login.aspx.cs
字号:
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 : System.Web.UI.Page
{
public void checkUser(String username, String password)
{
using (SqlCommand cmd = new SqlCommand())
{
cmd.Connection = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionStringUser"].ConnectionString);
cmd.CommandText = @"select [username],[password] from [Seeker]";
cmd.Connection.Open();
SqlDataReader reader = cmd.ExecuteReader();
while (reader.Read())
{
string name = reader[0].ToString();
string pass = reader[1].ToString();
if ((name.Equals(username)) && (pass.Equals(password)))
{
Response.Redirect("personalInfo.aspx");
}
}
reader.Close();
cmd.Connection.Close();
// Response.Redirect("Login.aspx");
}
//////////////////////////////////////////////////////////
using (SqlCommand cmd = new SqlCommand())
{
cmd.Connection = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionStringUser"].ConnectionString);
cmd.CommandText = @"select [username],[password] from [Company]";
cmd.Connection.Open();
SqlDataReader reader1 = cmd.ExecuteReader();
while (reader1.Read())
{
string name = reader1[0].ToString();
string pass = reader1[1].ToString();
if ((name.Equals(username)) && (pass.Equals(password)))
{
Response.Redirect("SearchCVs.aspx");
}
}
reader1.Close();
cmd.Connection.Close();
Response.Redirect("Login.aspx");
}
}
protected void submit_Click(object sender, EventArgs e)
{
String n = this.userName.Text;
String p = this.passWord.Text;
checkUser(n, p);
}
protected void Page_Load(object sender, EventArgs e)
{
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -