Stoyan, thank you very much for the helpful hint. I was able to restrict FileIO access of compiled assembly as intended. Except i get a small side effect which i need to work around. Let me try to explain the situation:
We have assembly A that is being compiled at runtime. By using [assembly:FileIOPermission(SecurityAction.RequestRefuse, Unrestricted = true)] directive, I've restricted FileIO access for assembly A. We also have assembly B that is considered a trusted assembly and is part of the Application Server. We are not performing any kind of restrictions on that assembly as we want it to be able to access File System. When assembly A tries to access FileSystem directly, it fails as intended. When assembly A tries to call a certain method on assembly B that will access File System it fails as well. But we want that to work. The error I get is: System.Security.SecurityException: Request for the permission of type System.Security.Permissions.FileIOPermission, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 failed. >From what I read i understand that it's happening due to the fact that assembly A is higher in the call stack and therefore assembly B no longer can access file IO. So, i've tried adding [FileIOPermission(SecurityAction.Assert, Unrestricted = true)] directive to the source code of assembly B to iallow it file system access despite the permission of the assembly A. That results in a slightly different error: System.Security.SecurityException: Request for the permission of type System.Security.Permissions.SecurityPermission, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 failed Any way I can get this working? Thanx! =================================== This list is hosted by DevelopMentor� http://www.develop.com NEW! ASP.NET courses you may be interested in: 2 Days of ASP.NET, 29 Sept 2003, in Redmond http://www.develop.com/courses/2daspdotnet Guerrilla ASP.NET, 13 Oct 2003, in Boston http://www.develop.com/courses/gaspdotnet View archives and manage your subscription(s) at http://discuss.develop.com
