• How to create and retrieve cookies in C#

    by  • May 16, 2013 • Microsoft .NET C# (C-Sharp), Microsoft ASP.NET • 0 Comments

    Cookie is a piece of text stored on the user’s browser or hard drive. Cookies are used to remember user preferences on the website. Information is stored on the client’s browser from server side when a user visits the website very first time or previously created cookies expired or removed. Next time user visits the site, server retrieves cookie information and uses that information for setting user preferences for that site. For every user, website store separate cookies and for every website separate cookies are stored in client’s browser.  Sometimes, client disables cookies on a browser. In that case, server is not allowed to create cookies for that user.

    Let’s see how to create cookies and how we can retrieve stored cookies.

    First way to create cookies

    Second way to create cookies

    Second way to retrieve cookies




    Namecheap.com
    Avatar of GetCodeSnippet.com

    About

    GetCodeSnippet.com provides you high quality Microsoft .NET development related articles, tutorials and sample code for ASP.NET, C#, VB.NET, AJAX, WCF, WPF, Web Services, Windows Services, SQL Server and other technologies.

    Leave a Reply