?? default.aspx.cs
字號(hào):
?using System;
using System.Data;
using System.Configuration;
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.Xml;
using xmlOp;//引用自定義命名空間
public partial class _Default : System.Web.UI.Page
{
string xmlFile = "";
protected void Page_Load(object sender, EventArgs e)
{
btreg.Visible = false;
xmlFile = Request.PhysicalApplicationPath + @"\xml\students.xml";//配置文件的Xml文件路徑
}
protected void bt1_Click1(object sender, EventArgs e)
{
string _username = tbusername.Text.Trim();
string _pwd = tbpassword.Text.Trim();
XmlOp op = new XmlOp(xmlFile);
//驗(yàn)證用戶名和密碼
if (op.SelectNode("//Root/Student", 0, _username) && op.SelectNode("//Root/Student", 1, _pwd))
{
Session["_username"] = _username;
Response.Redirect("show.aspx");
}
else
{
Msg("用戶名或密碼錯(cuò)誤!或你還沒注冊(cè)!注冊(cè)請(qǐng)點(diǎn)確定!");
btreg.Visible = true;
}
}
protected void bt2_Click(object sender, EventArgs e)
{
tbusername.Text = "";
tbpassword.Text = "";
}
//彈出對(duì)話框
public void Msg(string msg)
{
Page pg = (Page)HttpContext.Current.Handler;
string script = "alert('" + msg + "');";
pg.ClientScript.RegisterStartupScript(pg.GetType(), Guid.NewGuid().ToString(), script, true);
}
protected void btreg_Click(object sender, EventArgs e)
{
Response.Redirect("reg.aspx");
}
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -