ASP.NET Tutorial/Cookie/Write
Save value to cookie and read them back (VB)
<source lang="csharp">
<%@ Page Language="VB" %> <script runat="server">
sub Page_Load(Sender as Object, e as EventArgs) dim strVariable as string "set up some cookie variables Response.Cookies("temp").Value = "HI" Response.Cookies("myCookie")("Username") = "Chris" Response.Cookies("myCookie")("Preference") = "800x640" Response.Cookies("myCookie")("Password") = "CookiesRock" Response.Cookies("myCookie")("LastVisit") = DateTime.Now.ToString Response.Cookies("myCookie")("UserAgent") = Request.ServerVariables("HTTP_USER_AGENT") for each strVariable in Response.Cookies("myCookie").Values Label1.Text += "" & strVariable & ": " & _ Request.Cookies("myCookie")(strVariable) & "
" next end sub
</script> <html><body>
<form runat="server"> <asp:Label id="Label1" runat="server"/> </form>
</body></html></source>