Hi - I am using VS2008 Pro. I am trying to create a new xml using the below FileStream statement.

FileStream stream =
                    new FileStream(@"C:\employee11.xml", FileMode.Create);

I am getting the error - IOException was unhandled by user code
A required priviledge is not held by the client.

in the output windows I have seen error message

A first chance exception of type 'System.IO.IOException' occurred in mscorlib.dll.

I have googled to resolve this one. But didn't get anything relevant to this problem. Help me please..

6 Years
Discussion Span
Last Post by thines01

If you are using Vista or Windows 7, you should have an exception when trying to create a file on the root of C.
Choose a different directory.

Votes + Comments
Let Newbies know the internals. After All , C Drive Is Wahat you get in new laptops bundeled with Win 7...

Ya, Simple..
First Turn OFF UAC & Restart Your PC...
Then.... The Code WIll also check for read only & make the file normal.
File.SetAttributes("C:\employee11.xml", FileAttributes.Normal);

Votes + Comments
Bad advice to give to a new programmer.

@Pri Bhowmik:
Would it not be better to instruct new programmers not to write things in the root directory?

...than to disable UAC for ONE TEMPORARY FILE?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.