<%@ Page Language="C#" Debug="true" %> <script runat="server"> void Page_Load(Object sender , EventArgs e) { //*** Create Session ***// Session.Timeout = 20; Session["Name"] = "Mr.Weerachai Nukitram"; Session["NickName"] = "Mr.Win"; Session.Add("SiteName","www.ThaiCreate.Com"); //*** Delete Session ***// Session.Abandon(); //*** Read Session ***// foreach(String items in Session.Keys) { this.lblText1.Text = this.lblText1.Text + items + " = " + Session[items] + "<br>"; } this.hplLink.Text = "View Session"; this.hplLink.NavigateUrl = "AspNetSessionAbandon2.aspx"; } </script> <html> <head> <title>ThaiCreate.Com ASP.NET - Session Object</title> </head> <body> <form runat="server"> <asp:Label id="lblText1" runat="server"></asp:Label><br /><br /> <asp:HyperLink id="hplLink" runat="server"></asp:HyperLink><br /> </form> </body> </html>
<%@ Page Language="C#" Debug="true" %> <script runat="server"> void Page_Load(Object sender , EventArgs e) { //*** Delete Session ***// Session.Abandon(); //*** Read Session ***// foreach(String items in Session.Keys) { this.lblText1.Text = this.lblText1.Text + items + " = " + Session[items] + "<br>"; } this.hplLink.Text = "Back"; this.hplLink.NavigateUrl = "AspNetSessionAbandon1.aspx"; } </script> <html> <head> <title>ThaiCreate.Com ASP.NET - Session Object</title> </head> <body> <form runat="server"> <asp:Label id="lblText1" runat="server"></asp:Label><br /><br /> <asp:HyperLink id="hplLink" runat="server"></asp:HyperLink><br /> </form> </body> </html>
ช่วยกันสนับสนุนรักษาเว็บไซต์ความรู้แห่งนี้ไว้ด้วยการสนับสนุน Source Code 2.0 ของทีมงานไทยครีเอท