Adding cache dependencies (VB.net) : Cookie « Session Cookie « ASP.Net






Adding cache dependencies (VB.net)

<%@ Page Language="vb" %>
<%@ OutputCache Duration="300" VaryByParam="None" %>
<html>
   <head>
      <title>Adding cache dependencies in ASP.NET</title>
      <script runat="server">
         Sub Page_Load()
            Dim myArrayList As New ArrayList
            myArrayList.Add("Key1")
            myArrayList.Add("Key2")
            Response.AddCacheItemDependencies(myArrayList)
            Message.Text = DateTime.Now()
         End Sub
         Sub Button1_Click(sender As Object, e As EventArgs)
            Cache("Key1") = "value for key1"
         End Sub
         Sub Button2_Click(sender As Object, e As EventArgs)
            Cache("Key2") = "value for key2"
         End Sub
      </script>
   </head>
<body>
   <form runat="server">
      <asp:label id="Message" runat="server"/>
      <asp:button id="Button1" text="Change Key 1" onClick="Button1_Click" runat="server"/>
      <asp:button id="Button2" text="Change Key 2" onClick="Button2_Click" runat="server"/>
   </form>
</body>
</html>
           
       








Related examples in the same category

1.Create and retrieve Cookie data (C#)
2.Display all Cookie (C#)
3.Delete Cookie (C#)
4.Delete All Cookies (C#)
5.Setting a Cookie (VB.net)
6.Getting cookie values in ASP.NET
7.Setting expire date and path for cookies in ASP.NET (VHB.net)
8.Write Cookie and read Cookie (VB.net)
9.Save and retrieve values in Cookie (C#)
10.Save Cookie (Vb.net)
11.Set cookie expire date (VB.net)