diff --git "a/\347\254\2544\346\254\241\344\275\234\344\270\232/\346\226\271\350\215\243\346\230\237/WebForm1.aspx" "b/\347\254\2544\346\254\241\344\275\234\344\270\232/\346\226\271\350\215\243\346\230\237/WebForm1.aspx" new file mode 100644 index 0000000000000000000000000000000000000000..55d20eeac40525c5bc0fdb3ee1c9428dade5ae6f --- /dev/null +++ "b/\347\254\2544\346\254\241\344\275\234\344\270\232/\346\226\271\350\215\243\346\230\237/WebForm1.aspx" @@ -0,0 +1,17 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="WebApplication1.WebForm1" %> + + + + + + + + + +
+
+ +
+
+ + diff --git "a/\347\254\2544\346\254\241\344\275\234\344\270\232/\346\226\271\350\215\243\346\230\237/WebForm1.aspx.cs" "b/\347\254\2544\346\254\241\344\275\234\344\270\232/\346\226\271\350\215\243\346\230\237/WebForm1.aspx.cs" new file mode 100644 index 0000000000000000000000000000000000000000..92e5b158570be7e6aea26f4674d97f32224a9e6a --- /dev/null +++ "b/\347\254\2544\346\254\241\344\275\234\344\270\232/\346\226\271\350\215\243\346\230\237/WebForm1.aspx.cs" @@ -0,0 +1,24 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; + +namespace WebApplication1 +{ + public partial class WebForm1 : System.Web.UI.Page + { + protected void Page_Load(object sender, EventArgs e) + { + + } + + protected void Button1_Click(object sender, EventArgs e) + { + string name = TextBox1.Text; + Session["name"] = name; + Response.Redirect("WebForm2.aspx"); + } + } +} \ No newline at end of file diff --git "a/\347\254\2544\346\254\241\344\275\234\344\270\232/\346\226\271\350\215\243\346\230\237/WebForm2.aspx" "b/\347\254\2544\346\254\241\344\275\234\344\270\232/\346\226\271\350\215\243\346\230\237/WebForm2.aspx" new file mode 100644 index 0000000000000000000000000000000000000000..093ba63593a28152498c66ace7578de15efba551 --- /dev/null +++ "b/\347\254\2544\346\254\241\344\275\234\344\270\232/\346\226\271\350\215\243\346\230\237/WebForm2.aspx" @@ -0,0 +1,21 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm2.aspx.cs" Inherits="WebApplication1.WebForm2" %> + + + + + + + + + +
+
+
+ + + + +
+
+ + diff --git "a/\347\254\2544\346\254\241\344\275\234\344\270\232/\346\226\271\350\215\243\346\230\237/WebForm2.aspx.cs" "b/\347\254\2544\346\254\241\344\275\234\344\270\232/\346\226\271\350\215\243\346\230\237/WebForm2.aspx.cs" new file mode 100644 index 0000000000000000000000000000000000000000..29d02b50ccada7d72a362377d2fa4b6ce875dfb0 --- /dev/null +++ "b/\347\254\2544\346\254\241\344\275\234\344\270\232/\346\226\271\350\215\243\346\230\237/WebForm2.aspx.cs" @@ -0,0 +1,50 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; + +namespace WebApplication1 +{ + public partial class WebForm2 : System.Web.UI.Page + { + protected void Page_Load(object sender, EventArgs e) + { + if (Session["name"] != null) + { + if (Application["charRoom"] == null) + { + Application["charRoom"] = new Panel(); + } + this.Panel1.Controls.Add((Panel)Application["charRoom"]); + } + else + { + Response.Redirect("WebForm1.aspx"); + } + } + + protected void Button1_Click(object sender, EventArgs e) + { + string Text = TextBox1.Text; + string name = Session["name"].ToString(); + string NowTime = DateTime.Now.ToString(); + Literal literal1 = new Literal(); + literal1.Text = name + " " + NowTime + " " + Text + "
"; + ((Panel)Application["charRoom"]).Controls.Add(literal1); + } + + protected void Button2_Click(object sender, EventArgs e) + { + Page_Load(sender,e); + } + + protected void Button3_Click(object sender, EventArgs e) + { + Session.Abandon(); + Response.Redirect("WebForm1.aspx"); + Response.Redirect("WebForm1.aspx"); + } + } +} \ No newline at end of file diff --git "a/\347\254\2546\346\254\241\344\275\234\344\270\232/\346\226\271\350\215\243\346\230\237/WebForm1.aspx" "b/\347\254\2546\346\254\241\344\275\234\344\270\232/\346\226\271\350\215\243\346\230\237/WebForm1.aspx" new file mode 100644 index 0000000000000000000000000000000000000000..aa0c441146eafe5d7ce7824d62edac705230d1c1 --- /dev/null +++ "b/\347\254\2546\346\254\241\344\275\234\344\270\232/\346\226\271\350\215\243\346\230\237/WebForm1.aspx" @@ -0,0 +1,26 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="WebApplication1.WebForm1" %> + + + + + + + + + + + +
+

登录页面

+
+ 用户名:
+ 密码:
+ +
+ +
+ +
+
+ + diff --git "a/\347\254\2546\346\254\241\344\275\234\344\270\232/\346\226\271\350\215\243\346\230\237/WebForm1.aspx.cs" "b/\347\254\2546\346\254\241\344\275\234\344\270\232/\346\226\271\350\215\243\346\230\237/WebForm1.aspx.cs" new file mode 100644 index 0000000000000000000000000000000000000000..bb73f51662519cd1eaad6e78d8de506dc3a77b45 --- /dev/null +++ "b/\347\254\2546\346\254\241\344\275\234\344\270\232/\346\226\271\350\215\243\346\230\237/WebForm1.aspx.cs" @@ -0,0 +1,51 @@ +using System; +using System.Collections.Generic; +using System.Data.SqlClient; +using System.Linq; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; + +namespace WebApplication1 +{ + public partial class WebForm1 : System.Web.UI.Page + { + protected void Page_Load(object sender, EventArgs e) + { + + } + + protected void Button1_Click(object sender, EventArgs e) + { + string name = TextBox1.Text; + string pwd = TextBox2.Text; + string sql= "select * from StudentInfo where stu_name=@name and password=@pwd"; + string constr = "server=.;uid=sa;pwd=123456;database=Student_db"; + SqlConnection con = new SqlConnection(constr); + con.Open(); + SqlParameter[] para = { + new SqlParameter("@name",name), + new SqlParameter("@pwd",pwd) + }; + SqlCommand cmd = new SqlCommand(sql,con); + cmd.Parameters.Add(para); + int r= cmd.ExecuteNonQuery(); + SqlDataReader rea = cmd.ExecuteReader(); + if (rea.Read()) + { + Session[name] = name; + Response.Redirect("WebForm2.aspx"); + + } + else + { + Literal1.Text = "登录失败"; + } + } + + protected void Button1_Click1(object sender, EventArgs e) + { + + } + } +} \ No newline at end of file diff --git "a/\347\254\2546\346\254\241\344\275\234\344\270\232/\346\226\271\350\215\243\346\230\237/WebForm2.aspx" "b/\347\254\2546\346\254\241\344\275\234\344\270\232/\346\226\271\350\215\243\346\230\237/WebForm2.aspx" new file mode 100644 index 0000000000000000000000000000000000000000..ce8759767e8aa0d21b0db1650ee7fb6c80a0e1c3 --- /dev/null +++ "b/\347\254\2546\346\254\241\344\275\234\344\270\232/\346\226\271\350\215\243\346\230\237/WebForm2.aspx" @@ -0,0 +1,16 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm2.aspx.cs" Inherits="WebApplication1.WebForm2" %> + + + + + + + + + +
+
+
+
+ + diff --git "a/\347\254\2546\346\254\241\344\275\234\344\270\232/\346\226\271\350\215\243\346\230\237/WebForm2.aspx.cs" "b/\347\254\2546\346\254\241\344\275\234\344\270\232/\346\226\271\350\215\243\346\230\237/WebForm2.aspx.cs" new file mode 100644 index 0000000000000000000000000000000000000000..57f015807d98954b9d78212bdbeaffdc1efd4c6c --- /dev/null +++ "b/\347\254\2546\346\254\241\344\275\234\344\270\232/\346\226\271\350\215\243\346\230\237/WebForm2.aspx.cs" @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; + +namespace WebApplication1 +{ + public partial class WebForm2 : System.Web.UI.Page + { + protected void Page_Load(object sender, EventArgs e) + { + + } + } +} \ No newline at end of file