1

I have a project in .NET ,when i tries to run it,it runs normally but at time of hiding a file the following error come.

An unhandled exception of type 'System.UnauthorizedAccessException' occurred in mscorlib.dll .
Additional information: 
Access to the path 'C:\temp2.txt' is denied.

The project is a stegnography application having des and rijndael algorithms.I am using MS visual studio Express 2012 on windows 7.

Gwenc37
  • 2,064
  • 7
  • 18
  • 22
  • Please post a sample of the code you are using to access the file. It will greatly help others to answer your question. Also, is UAC turned on? If so, UAC may be blocking access to the path. – akton Apr 29 '14 at 05:49
  • http://stackoverflow.com/questions/20576196/an-unhandled-exception-of-type-system-unauthorizedaccessexception-occurred-in – Nagaraj S Apr 29 '14 at 06:07
  • UAC is turned on.Here's the code:private void GenKeyFile() { FileStream fs = new FileStream("C:\\temp2.txt", FileMode.OpenOrCreate, FileAccess.Write); byte[] keyBytes = UnicodeEncoding.Unicode.GetBytes(Password_1.Text+Password_2.Text); fs.Write(keyBytes, 0, Password_1.Text.Length*2); fs.Close(); } – user2834961 Apr 29 '14 at 06:22

0 Answers0