isolated sorage
How to create isolated storage in console application..?
1 Answer
Know the answer? Post it. Somebody with the same question will find it here.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend4days leftRegister
Abhishek JainRank #1,062 · 1.8K reputationPosted Aug 29, 2013, 4:36 AM EDT
You can create a file in isolated storage for each user using your console application, or you can say the user logged into the system for running that application, or the user with which credentials your application is running..
For creating isolated storage use the following code:
IsolatedStorageFile isolatedStorageFile = IsolatedStorageFile.GetStore(IsolatedStorageScope.User | IsolatedStorageScope.Assembly, null, null);
if (isolatedStorageFile.FileExists("IsolatedStorage.txt"))
{
//Got the dile
using (IsolatedStorageFileStream isolatedStorageFileStream = new IsolatedStorageFileStream("IsolatedStorage.txt", FileMode.Open, isolatedStorageFile))
{
using (StreamReader streamReader = new StreamReader(isolatedStorageFileStream))
{
//Here you can read the contents
}
//You can also update it if you want..
}
}
else
{
using (IsolatedStorageFileStream isolatedStorageFileStream = new IsolatedStorageFileStream("IsolatedStorage.txt", FileMode.CreateNew, isolatedStorageFile))
{
//File Created
using (StreamWriter streamWriter = new StreamWriter(isolatedStorageFileStream))
{
//Write to the file
}
}
}
Temporary file will be created in isolated storage:
Location: C:\Users\
Attachment is a sample application..