Mega Code Archive

 
Categories / ASP.Net / Session Cookie
 

Get session static objects (VB net)

<%@ Page Language="vb" %> <html>    <head>       <script runat="server">          Sub Page_Load()             Message.Text = "There are " & Session.StaticObjects.Count & _                " objects declared with the " & _                "&lt;object runat=&quot;server&quot;&gt; syntax in Session scope."             Dim myobj As Object             For Each myObj in Session.StaticObjects                If myObj.Value.GetType.ToString() = _                   "System.Web.UI.WebControls.TextBox" Then                   myForm.Controls.Add(myObj.Value)                End If             Next          End Sub       </script>    </head> <body>    <form id="myForm" runat="server">       <asp:label id="Message" runat="server"/>    </form> </body> </html>