-
April 9th, 2014, 11:40 PM
#1
“Access to this path is denied” in Windows 7 application
Ran into a strange phenomena:
in Application A, the
Code:
Using sr = New StreamReader(pathDir)
runs perfectly (where pathDir is C:\tmp for example. This directory is on the local machine and I have full permissions).
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,
Amir
-
April 10th, 2014, 09:12 AM
#2
Re: “Access to this path is denied” in Windows 7 application
If I'm not mistaken streamreader expects a filename.
I would expect the code above to try to open a file in C:\ named tmp and would not be surprised to get this error. I would be surprised if I did not get the error.
Try specifying a filename in your tmp folder and see what happens
Always use [code][/code] tags when posting code.
-
April 10th, 2014, 10:48 AM
#3
Re: “Access to this path is denied” in Windows 7 application
Originally Posted by DataMiser
If I'm not mistaken streamreader expects a filename.
I would expect the code above to try to open a file in C:\ named tmp and would not be surprised to get this error. I would be surprised if I did not get the error.
Try specifying a filename in your tmp folder and see what happens
Yeh, you are absolutely right, and I'm feeling awkward..
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|