From ab3e7d434b7bdc10ec7ef65aa90faec7a4dc71fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=8D=E6=84=BF=E9=80=8F=E9=9C=B2=E5=A7=93=E5=90=8D?= =?UTF-8?q?=E7=9A=84=E6=96=B9=E5=90=8C=E5=AD=A6?= <2407924554@qq.com> Date: Wed, 16 Jun 2021 11:35:56 +0800 Subject: [PATCH 1/2] 1 --- .../WebForm1.aspx" | 17 +++++++ .../WebForm1.aspx.cs" | 24 +++++++++ .../WebForm2.aspx" | 21 ++++++++ .../WebForm2.aspx.cs" | 50 +++++++++++++++++++ 4 files changed, 112 insertions(+) create mode 100644 "\347\254\2544\346\254\241\344\275\234\344\270\232/\346\226\271\350\215\243\346\230\237/WebForm1.aspx" create mode 100644 "\347\254\2544\346\254\241\344\275\234\344\270\232/\346\226\271\350\215\243\346\230\237/WebForm1.aspx.cs" create mode 100644 "\347\254\2544\346\254\241\344\275\234\344\270\232/\346\226\271\350\215\243\346\230\237/WebForm2.aspx" create mode 100644 "\347\254\2544\346\254\241\344\275\234\344\270\232/\346\226\271\350\215\243\346\230\237/WebForm2.aspx.cs" 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 0000000..55d20ee --- /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 0000000..92e5b15 --- /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 0000000..093ba63 --- /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 0000000..29d02b5 --- /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 -- Gitee From d7973edc2686223e250f7e1a4d6fe3de81e5e3d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=8D=E6=84=BF=E9=80=8F=E9=9C=B2=E5=A7=93=E5=90=8D?= =?UTF-8?q?=E7=9A=84=E6=96=B9=E5=90=8C=E5=AD=A6?= <2407924554@qq.com> Date: Tue, 22 Jun 2021 14:41:54 +0000 Subject: [PATCH 2/2] 1 --- .../WebForm1.aspx" | 26 ++++++++++ .../WebForm1.aspx.cs" | 51 +++++++++++++++++++ .../WebForm2.aspx" | 16 ++++++ .../WebForm2.aspx.cs" | 17 +++++++ 4 files changed, 110 insertions(+) create mode 100644 "\347\254\2546\346\254\241\344\275\234\344\270\232/\346\226\271\350\215\243\346\230\237/WebForm1.aspx" create mode 100644 "\347\254\2546\346\254\241\344\275\234\344\270\232/\346\226\271\350\215\243\346\230\237/WebForm1.aspx.cs" create mode 100644 "\347\254\2546\346\254\241\344\275\234\344\270\232/\346\226\271\350\215\243\346\230\237/WebForm2.aspx" create mode 100644 "\347\254\2546\346\254\241\344\275\234\344\270\232/\346\226\271\350\215\243\346\230\237/WebForm2.aspx.cs" 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 0000000..aa0c441 --- /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 0000000..bb73f51 --- /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 0000000..ce87597 --- /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 0000000..57f0158 --- /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 -- Gitee