日期:2014-05-17 浏览次数:20445 次
using System;
using System.Configuration;
using System.Data;
using System.Collections;
using System.Data.Sql;
using System.Data.SqlClient;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using Eos.Class;
public partial class Denglu : System.Web.UI.Page
{
//用户登录界面
protected void Page_Load(object sender, EventArgs e)
{
}
protected void BT_yes_Click(object sender, EventArgs e)
{
/*
EOSCode EosDenglu = new EOSCode();
if (EosDenglu.CheckUser(username,userpsw)==true)
{
Session["username"] = username.ToString();
Response.Redirect("HomePage.aspx");
}
else
{
ClientScript.RegisterStartupScript(this.GetType(), "", "alert('用户名或密码错误!');", true);
}
*/
if (CheckUser() == true)
{
Response.Redirect("~/CPage/HomePage.aspx");
}
else
{
ClientScript.RegisterStartupScript(this.GetType(), "", "alert('用户名或密码错误!');", true);
}
}
private bool CheckUser()
{
bool myReturnValue = false;
string username = TB_name.Text.Trim();
string userpsw = TB_psw.Text.Trim();
string mySql = "select * from users where username='" + username + "' and userpsw='" + userpsw + "'";
EosClass myCnt = new EosClass();
DataRow myRow = myCnt.GetDataRow(mySql);
if (myRow!= null)
&n