Hello,
I'm writing an application in C# (it's very basic, for a friend of mine), but I have a StreamWriter object that creates a local file in C:. I have to do Run as Administrator, and it works fine, but otherwise it crashes with "Access to the path 'C:\final.html' is denied."
I've never worked with any sort of security or permissions in code before. What can I do to grant it access to that folder without having to run as administrator?
EDIT: Here's what I ended up doing:
string desktop = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
using (StreamWriter output = new StreamWriter(Path.Combine(desktop, "final.html"))
{
//...additional code
output.Write(inputArray.Substring(lastIndex, range.Start - lastIndex));
//...additional code
output.Close();
}