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

Best quality Asp .Net Ajax Control Toolkit tutorials.

Give your valuable comments.

Name
Email
Comment
2 + 2 =
 

About Us | Terms of Use | Privacy Policy | Disclaimer | Contact Us Copyright © 2012-2024 CodingFusion
50+ C# Programs for beginners to practice