FileIOPermission issue

  • Thread starter Thread starter Mircea Pleteriu
  • Start date Start date
M

Mircea Pleteriu

Hi all,

I have this code sample

FileIOPermission fp = new FileIOPermission(PermissionState.Unrestricted);

fp.Deny();

StreamWriter sw = new StreamWriter(@"c:\test.txt");

sw.Write("Test");

sw.Close();



I do not understand why the file is still created?
 
I think that
fp.deny only prevents callers of the function from using the functionality.
In the MSDN documentation, they mention that deny prevents callers higher in
the call stack from using the resource.

rc
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top