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++)

        grdCookies.DataSource = colCookies;



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.



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.

6 + 8 =
About Us | Terms of Use | Privacy Policy | Disclaimer | Contact Us Copyright © 2012-2023 CodingFusion
75 Important SQL Server queries you should know