How to read a Cookie
<script language="c#" runat="server">
private void Page_Load(object sender, System.EventArgs e)
{
ListBox1.Items.Clear();
HttpCookieCollection cookieCols = new HttpCookieCollection();
cookieCols = Request.Cookies;
foreach (string str in cookieCols)
{
ListBox1.Items.Add("Cookie: " + str);
ListBox1.Items.Add("Value:" + Request.Cookies(str).Value);
}
}
</script>
<HTML>
<body>
<form id="Form1" method="post" runat="server">
<asp:ListBox id="ListBox1" runat="server" Width="341px" Height="169px"></asp:ListBox>
</form>
</body>
</HTML>
Download Code...
Print Page