Read and Display all cookies in asp .net

In this asp .net tutorial we will learn how to read and display all cookies created by website. We have learned how to write and read single value cookies and how to write and read cookies with more than one value in asp .net. Now at some point it might be required to check values of all the cookies created by website for testing or any other purpose. 

 

In this tutorial we will read cookies from cookies collection and display in Gridview. 

 

Step1: Create a new asp .net website.

 

Step2: Add gridview to your page.

 


 

Step3: Add following code in your code behind page.

 

        ArrayList colCookies = new ArrayList();
        for (int i = 0; i < Request.Cookies.Count; i++)
            colCookies.Add(Request.Cookies[i]);

        grdCookies.DataSource = colCookies;
        grdCookies.DataBind();

 

 

Tip: If you have found any issues regarding writing and reading cookies. You can check whether cookies are enabled in your browser or not. Also you can encrypt and decrypt cookies to apply some level of security.

 

Bind-All-cookies-in-gridview

We are nothing without our users ! You can help us offer even more high quality content. Please share our page !
Best quality Asp .Net Ajax Control Toolkit tutorials.

Give your valuable comments.

Name
Email
Comment
7 + 6 =
 
About Us | Terms of Use | Privacy Policy | Disclaimer | Contact Us Copyright © 2012-2019 CodingFusion
75 Important SQL Server queries you should know