Veerendra Veerendra - 1 year ago 156
C# Question

how to create cookies in windows forms using c#?

how to create cookies in windows forms using c#?
or is there any way to save data "LIKE" cookies.

I want to save username and password in client machine so is there any other way to save


Answer Source

Cookies are for websites, not Windows forms. But ultimately, cookies are just files that are dropped on the client machine that can be read and updated as you require. In which case, you could just drop and read files using System.IO.StreamWriter and System.IO.StreamReader. Something like this:

var writer = new System.IO.StreamWriter("MyFilename.txt");
writer.WriteLine("some text here");

And to read the file:

var reader = new System.IO.StreamReader("MyFilename.txt");
var fileContents = reader.ReadToEnd();
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download