Preface:
This is my first winform application and I am aware of my ignorance on the issue. Please clarify any fundamental flaws I may be propagating.
I have an application that attempts to write a text file to the C: drive of the computer it is installed on. The purpose of this is to be able to read and write to the file at a later point. It works locally on my machine, but access is denied when the application first tries to write the file on a client machine and rightfully so I reckon. I understand that this is not a good idea.
So my question ultimately would be, where is a better place to try and write that file without experiencing permission issues? Or, is there a better way to store readable/writable string data when a database cannot be involved?
Code:
var path = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
using (StreamWriter clientData = new StreamWriter(path, true))
{
clientData.Write(string.Format("{0}, {1},", clientFirstName.Text.ToUpper(), clientLastName.Text.ToUpper()));
clientData.Write(string.Format("{0},", clientAddress.Text.ToUpper()));
clientData.Write(string.Format("{0},", clientPhone.Text.ToUpper()));
clientData.Write(string.Format("{0},", clientEmail.Text.ToUpper()));
clientData.Write(string.Format("{0},", (cbMonth.Text + "/" + cbDay.Text + "/" + cbYear.Text)));
clientData.Write(string.Format("{0},", clientStartDate.Text.ToUpper()));
clientData.Write(string.Format("{0},", clientProducts.Text.ToUpper()));
clientData.Write(string.Format("{0},", clientWeight.Text.ToUpper()));
clientData.Write(string.Format("{0}, {1}, {2}, {3}, {4},", clientChest.Text.ToUpper(), clientBelly.Text.ToUpper(), clientHips.Text.ToUpper(), clientThigh.Text.ToUpper(), clientArm.Text.ToUpper()));
clientData.Write(string.Format("{0}, {1}, {2}, {3}, {4}, {5}, {6}, {7},", clientBodyFat.Text.ToUpper(), clientHydration.Text.ToUpper(), clientMuscleMass.Text.ToUpper(), clientPhysiqueRating.Text.ToUpper(), clientBMR.Text.ToUpper(), clientMetabolicAge.Text.ToUpper(), clientBoneMass.Text.ToUpper(), clientVisceralFat.Text.ToUpper()));
clientData.Write(string.Format("{0}", commentsNotes.Text.ToUpper()));
clientData.Write(clientData.NewLine);
success = true;
}