Login | Sign Up
ErrorKey - Search engine for Error codes and messages       Comment an error
Return to search results
JScript .NET does not support declarative security attributes A custom attribute that inherits from CodeAccessSecurityAttribute is applied to the definition of a method, class, or assembly. This is not allowed. Dynamic security must be used instead of declarative security attributes to control access to a portion of code. Note Only early-bound code can make calls to the Assert, Deny or PermitOnly security methods within the .NET Framework. This means that type-annotated variables must be used to store permission objects, since type annotation allows the compiler to generate early-bound code. Moreover, code generated at runtime (with the eval method or with a Function object created with the new operator) is late-bound code, which prevents it from making calls to the Assert, Deny or PermitOnly methods. In the following example, dynamic security is used to deny access to a particular file by a method. Copy Code import System; import System.IO; import System.Security; import System.Security.Permissions; class Alpha{ function Bravo() { var fileioperm : FileIOPermission; fileioperm = new FileIOPermission(FileIOPermissionAccess.AllAccess, 'd:\\temp\\myfile.txt'); fileioperm.Deny(); // Any additional code in this method will be // denied access to d:\temp\myfile.txt. } }
Use dynamic security instead of declarative secu ...  Login to see more
JScript Run-time Errors

You must login to post a comment.