C#, working with files, "Unauthorized Access"?
- by Rob
Hi,
I'm learning about opening and saving files with C# and it seems that vista won't let my program save to a file on the root of C:\ , unless I run it in administrator mode.
Any ideas how to allow my program to play around with whatever files it wants?
Thanks!
string name;
private void button2_Click(object sender, EventArgs e) ///// OPEN /////
{
if (openFileDialog1.ShowDialog() == DialogResult.OK)
{
name = openFileDialog1.FileName;
textBox1.Clear();
textBox1.Text = File.ReadAllText(name);
textBox2.Text = name;
}
}
private void button1_Click(object sender, EventArgs e) ///// SAVE /////
{
File.WriteAllText(name, textBox1.Text);
}