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:
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:
Abhishek JainPosted Aug 29, 2013, 8:36 AM
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..