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..

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.

commented: Let Newbies know the internals. After All , C Drive Is Wahat you get in new laptops bundeled with Win 7... -1

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

commented: Bad advice to give to a new programmer. -2

@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?