I am trying to create a FileStream but keep getting “UnauthorisedAccessException”, what is wrong with this statement?
FileStream fs = new FileStream(@"C:\", FileMode.Create, FileAccess.ReadWrite);
Thanks,
Eamonn
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You are not allowed to open a file stream that points to the root directory of your C partition. I assume, that’s not what you want to do. If you want to create a file, than specify a file name.