📄 login.aspx
字号:
<%@ Page Language="C#" %>
<%@Import Namespace="System.Data" %>
<%@Import Namespace="System.Data.OleDb" %>
<%@Import Namespace="System.Xml" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
protected void btlogin_Click(object sender, EventArgs e)
{
string dnhap, mk;
mk = txtmk.Value;
dnhap = txtdangnhap.Value;
string strCurrentPath = Request.PhysicalPath;
string strXMLPath = strCurrentPath.Substring(0, strCurrentPath.LastIndexOf("\\"))
+ "\\QuanLySinhVien.xml";
XmlDocument doc = new XmlDocument();
doc.Load(strXMLPath);
XmlNodeList ndung, pass;
ndung = doc.GetElementsByTagName("Username");
pass = doc.GetElementsByTagName("Password");
if (dnhap == ndung[0].FirstChild.Value && mk == pass[0].FirstChild.Value)
{
Session["username"] = dnhap;
Response.Redirect("Admin.aspx");
}
bool tim = false;
for (int i = 1; i < ndung.Count; i++)
{
if (dnhap == ndung[i].FirstChild.Value && mk == pass[i].FirstChild.Value)
{
tim = true;
}
if (tim == false)
{
lbkq.Text = "Bạn đã nhập thông tin không đúng.";
}
if (tim)
{
Session["username"] = dnhap;
Response.Redirect("Ttsv.aspx");
}
}
}
protected void Page_Load(object sender, EventArgs e)
{
Session.Clear();
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Label ID="Label1" runat="server" Style="position: relative" Text="Username"></asp:Label><input
id="txtdangnhap" runat="server" style="left: 8px; width: 136px; position: relative;
top: 0px" type="text" /><input id="txtmk" runat="server" style="left: -134px; width: 136px;
position: relative; top: 40px" type="text" /><asp:Button ID="btlogin" runat="server"
OnClick="btlogin_Click" Style="left: -190px; position: relative; top: 96px" Text="Login" /><asp:Label
ID="Label3" runat="server" Style="left: -392px; position: relative; top: 41px"
Text="Password"></asp:Label>
</div>
</form>
<div id="bang" runat="server">
<br />
<br />
<asp:Label ID="lbkq" runat="server" Height="8px" Style="left: 19px; position: relative;
top: 52px"></asp:Label> </div>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -