|
|
|
Config IIS แล้ว Connect mySQL ได้บ้างไม่ได้บ้างค่ะ |
|
|
|
|
|
|
|
มี Error แจ้งหรือเปล่าครับ
|
|
|
|
|
Date :
2011-01-10 10:24:33 |
By :
webmaster |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ไม่มี Error เลยค่ะ
แต่เขียนดักไว้ว่า
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
Session.Timeout = 60;
logout();
txtbox_usname.Text = "";
txtbox_pass.Text = "";
//Load Config
ClsXML_Serialization xml = new ClsXML_Serialization();
Session["ListServerSite"] =
xml.DeserializeFromXml<List<ClsServerSite>>(Server.MapPath("Config/ConfigSubSite.xml"));
Session["MainServerSite"] =
xml.DeserializeFromXml<ClsServerMain>(Server.MapPath("Config/ConfigMainSite.xml"));
}
}
ตอนล็อกอินค่ะ
protected void Butt_Signin_Click(object sender, EventArgs e)
{
using (ClsDB_SQL DB_SQL = new ClsDB_SQL())
{
string usname = this.txtbox_usname.Text.Trim();
string pass = this.txtbox_pass.Text.Trim();
ClsServerMain objmain = Session["MainServerSite"] as ClsServerMain;
bool Isconn = false;
Isconn = DB_SQL.ConnectMainSite(objmain);
if (!Isconn)
{
//เข้าตรงนี้อ่ะค่ะ ปัญหาเกิดจากตรงนี้
this.Lbl_satus.Text = "Connecting Server Fail!";
return;
}
string Qstr = "select id,username,location,grouptype from ";
Qstr += " db_receive_box.user_receive where username ='" + usname + "' and password='" + pass + "';";
DataTable DT = DB_SQL.Query_Select(Qstr);
if (DT.Rows.Count == 0)
{
/
this.Lbl_satus.Text = "Username or Password Incorrect!";
}
else
{
this.Lbl_satus.Text = "Sign in Success!";
Session["SessUser"] = new ClsObj_SessUser(
Convert.ToInt32(DT.Rows[0]["id"]),
Convert.ToString(DT.Rows[0]["username"]),
Convert.ToString(DT.Rows[0]["location"]),
Convert.ToInt32(DT.Rows[0]["grouptype"]));
Response.Redirect("~/Main.aspx");
}
}
}
|
|
|
|
|
Date :
2011-01-10 11:33:36 |
By :
njnight |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 04
|