Sessions and Cookies in c# window application

 Cookies do not exist in windows applications - instead data is either saved in files, or in application settings, or in the registry depending on the quantity of data and it's organisation. You might save it in a database, or an XML file, or as straight binary info.

But you don't use cookies in windows apps - they are for setting on the client from the server and those concepts do not apply when using Windows apps.

Application settings are probably the easiest:
1) Click on the project in Solution Explorer, choose "Properties".
2) Double click "Settings.Settings".
3) In the resulting dialog, Create application settings by specifying the Name, Type and Value - leave the "Scope" as "User".
4) You can now save and load your values easily:

            Properties.Settings.Default.MySettingString = "New Value";
            Properties.Settings.Default.Save();
            ...
            string myValue = Properties.Settings.Default.MySettingString;

Post a Comment

0 Comments