看板 NDHU_CSIE12 關於我們 聯絡資訊
Session protected void Button1_Click(object sender, EventArgs e) { // 設定Session變數 Session["UserName"] = txtUser.Text; Session["UserPassword"] = txtPass.Text; // 轉址到其他ASP.NET網頁 Response.Redirect("Ch7-5-2.aspx"); } protected void Page_Load(object sender, EventArgs e) { string name, password; lblOutput.Text = "Session ID:" + Session.SessionID + "<br/>"; if (Session["UserName"] != null) { // 取得Session變數值 name = Session["UserName"].ToString(); password = Session["UserPassword"].ToString(); // 顯示取得的Session變數值 lblOutput.Text += "名稱: " + name + "<br/>"; lblOutput.Text += "密碼: " + password + "<br/>"; Session.Abandon(); // 放棄Session } } -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 134.208.3.230
etpket:這啥= = 11/08 17:14