I want to create a local txt file and store username after login success and for next login the app will check on this file if the username exists for bypass login. But it seems like no file created when I testing it
bool bRet = ws.RequestMemberLogin(1, userName.Text, pass.Text, "", "");
string path = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal);
string filename = System.IO.Path.Combine(path, "user.txt");
FileInfo fi = new FileInfo(filename);
bool exist = fi.Exists;
if (bRet)
{
if (exist)
{
// Read
using (StreamReader streamReader = new StreamReader(filename))
{
string content = streamReader.ReadToEnd();
System.Diagnostics.Debug.WriteLine(content);
}
}
else
{
// Write
using (StreamWriter streamWriter = new StreamWriter(filename, true))
{
streamWriter.WriteLine(userName.Text);
}
}
Intent intent = new Intent(this, typeof(datalist));
StartActivity(intent);
}
else
{
error.Text = "Invalid username or password!";
}