<%@ Page Language="VB" %> <script runat="server"> Sub Page_Load(sender As Object, e As EventArgs) '*** 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 ***' Dim items As Object For Each items In Session.Keys Me.lblText1.Text = Me.lblText1.Text & items & " = " &Session(items) & "<br>" Next Me.hplLink.Text = "View Session" Me.hplLink.NavigateUrl = "AspNetSessionAbandon2.aspx" End Sub </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="VB" %> <script runat="server"> Sub Page_Load(sender As Object, e As EventArgs) '*** Delete Session ***' Session.Abandon() '*** Read Session ***' Dim items As Object For Each items In Session.Keys Me.lblText1.Text = Me.lblText1.Text & items & " = " &Session(items) & "<br>" Next Me.hplLink.Text = "Back" Me.hplLink.NavigateUrl = "AspNetSessionAbandon1.aspx" End Sub </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 ของทีมงานไทยครีเอท