boutique replica bags up ideas

the best replique rolex and prices here.

julia highlight 99j hair color 10a quality straight human hair lace front wigs 8 - 24 inches pre plucked hairline 13x4 inches lace front brazilian wig onlinefor sale

How to Read Cookie Value in ASP.NET?

Updated on     Kisan Patel

This tutorial will explain you two different ways of reading cookie in ASP.NET website.

Method 1

Default.aspx

<asp:Button ID="btnRead1" runat="server" Text="Read Cookie - 1"
 OnClick="ReadCookie1" />

Default.aspx.cs

protected void ReadCookie1(object sender, EventArgs e)
{
 HttpCookie cookie = Request.Cookies["CookieKey1"];
 Response.Write(cookie.Value);
}

In method 1, we are retrieving the cookie using Request object and saving intoHttpCookie variable. The next line writes the cookie value on the page.

Method 2

Default.aspx

<asp:Button ID="btnRead2" runat="server" Text="ReadCookie - 2"
 OnClick="ReadCookie2" />

Default.aspx.cs

protected void ReadCookie2(object sender, EventArgs e)
{
 Response.Write(Request.Cookies["CookieKey2"].Value);
}

In method 2, we are retrieving the cookie value using Request.Cookies collection by passing the Cookiename as parameter.

Demo

read-cookie-demo

Download Complete Source Code


ASP.NET

Leave a Reply