April 9th, 2014, 11:40 PM
“Access to this path is denied” in Windows 7 application
Ran into a strange phenomena:
in Application A, the
runs perfectly (where pathDir is C:\tmp for example. This directory is on the local machine and I have full permissions).
Using sr = New StreamReader(pathDir)
In Application B the same line, on the same directory (on the same machine) throws the exception: "Access to the path is denied".
The code checks that the directory is not read-only before trying to create the streamReader.
This happens when run in the IDE or by activating the exe file.
Some additional information:
Windows 7 Pro, 64bit, VS 2013 (same happens with VS2010 generated app).
The app.manifest of both application is identical. I've tried changing to all possible options of requestedExecutionLevel but the result was the same.
The target framework of the application is 4.
The exception is thrown whether I run as administrator or not.
I've set the permissions of the directory to full control for all accounts (including Administrator and Everyone).
I've deleted the directory and recreated it. Didn't help.
Ran Farbar and Avira scan which did not report any problems.
Any advice will be much appreciated,
Click Here to Expand Forum to Full Width
This a Codeguru.com survey!