FileIOPermission problem



Hello,

I am working on a C# console app.
When I do this:

DirectoryInfo di = new DirectoryInfo(".");

I get an exception:
Request for the permission of type
'System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.0.0,
Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.

I added this before the DirectoryInfo creation:

FileIOPermission f = new FileIOPermission(PermissionState.None);
f.AllLocalFiles = FileIOPermissionAccess.Read;

but the error still occurs.

My app needs to read certain files in the current dir, and then create new
files. How does the app get the permissions to do those things?

Thanks for any insight...


.



Relevant Pages

  • Re: 500 error while GetResponse()
    ... You would of course need to handle any Exception thrown by this method with ... >> The first would mean that the server that your WebRequest sent a Request ... >> The second would mean that your ASP.Net app has a problem. ... >> ..Net Developer ...
    (microsoft.public.dotnet.framework.aspnet)
  • ASPUSER account problem?
    ... I've installed an app that requires ASP.NET 1.1. ... An unhandled exception occurred during the execution of the ... granting access rights to the resource to the ASP.NET request identity. ... Microsoft.Win32.RegistryKey.Win32Error(Int32 errorCode, String str) +74 ...
    (microsoft.public.inetserver.iis.security)
  • Re: Apply security permission in class library, fail to call it ou
    ... if there is a permission denied from the OS it should ... You can do something else - try to do a security ... can intercept where the exception comes from. ... to compile in a Debug mode and catch the permission at app level. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: How to prevent files from being changed/moved/copied/printed
    ... >> access requirements and then set the ACLing to effect ... > Delete permission to prevent moving files, but if you try to use MS Office ... > What the OP probably really wants to use is IRM, ... which app runs in some security context other than the viewing ...
    (microsoft.public.security)
  • Defining minimum permissions
    ... I'm trying to work out a minimum permission set that my app (several ... separate assemblies) needs. ... it seems like it would really make sense not to request complete ...
    (microsoft.public.dotnet.security)

Loading