18 [SecuritySafeCritical]
21 StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller;
22 SecurityRuntime.RevertAssert(ref stackMark);
28 [SecuritySafeCritical]
29 [Obsolete(
"Deny is obsolete and will be removed in a future release of the .NET Framework. See http://go.microsoft.com/fwlink/?LinkID=155570 for more information.")]
32 StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller;
33 SecurityRuntime.RevertDeny(ref stackMark);
39 [SecuritySafeCritical]
42 StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller;
43 SecurityRuntime.RevertPermitOnly(ref stackMark);
49 [SecuritySafeCritical]
52 StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller;
53 SecurityRuntime.RevertAll(ref stackMark);
59 [SecuritySafeCritical]
62 if (!CheckDemand(
null))
64 StackCrawlMark stackMark = StackCrawlMark.LookForMyCallersCaller;
65 CodeAccessSecurityEngine.Check(
this, ref stackMark);
70 [SecuritySafeCritical]
71 internal static void Demand(PermissionType permissionType)
73 StackCrawlMark stackMark = StackCrawlMark.LookForMyCallersCaller;
74 CodeAccessSecurityEngine.SpecialDemand(permissionType, ref stackMark);
80 [SecuritySafeCritical]
83 StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller;
84 CodeAccessSecurityEngine.Assert(
this, ref stackMark);
88 [SecuritySafeCritical]
89 internal static void Assert(
bool allPossible)
91 StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller;
92 SecurityRuntime.AssertAllPossible(ref stackMark);
98 [SecuritySafeCritical]
99 [Obsolete(
"Deny is obsolete and will be removed in a future release of the .NET Framework. See http://go.microsoft.com/fwlink/?LinkID=155570 for more information.")]
102 StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller;
103 CodeAccessSecurityEngine.Deny(
this, ref stackMark);
109 [SecuritySafeCritical]
112 StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller;
113 CodeAccessSecurityEngine.PermitOnly(
this, ref stackMark);
132 XMLUtil.AddClassAttribute(securityElement, perm.GetType(), permname);
134 return securityElement;
137 internal static void ValidateElement(SecurityElement elem, IPermission perm)
143 if (!XMLUtil.IsPermissionElement(perm, elem))
145 throw new ArgumentException(Environment.GetResourceString(
"Argument_NotAPermissionElement"));
147 string text = elem.Attribute(
"version");
148 if (text !=
null && !text.Equals(
"1"))
150 throw new ArgumentException(Environment.GetResourceString(
"Argument_InvalidXMLBadVersion"));
156 public abstract SecurityElement
ToXml();
162 public abstract void FromXml(SecurityElement elem);
173 if (perm ==
null || perm.GetType() != GetType())
182 public abstract IPermission
Copy();
188 public abstract IPermission
Intersect(IPermission target);
195 public abstract bool IsSubsetOf(IPermission target);
205 if (obj !=
null && permission ==
null)
215 if (permission !=
null && !permission.
IsSubsetOf(
this))
232 return base.GetHashCode();
240 internal bool CheckPermitOnly(CodeAccessPermission permitted)
245 internal bool CheckDeny(CodeAccessPermission denied)
250 internal bool CheckAssert(CodeAccessPermission asserted)
void PermitOnly()
Prevents callers higher in the call stack from using the code that calls this method to access all re...
The exception that is thrown when a null reference (Nothing in Visual Basic) is passed to a method th...
Describes a set of security permissions applied to code. This class cannot be inherited.
static void RevertPermitOnly()
Causes any previous M:System.Security.CodeAccessPermission.PermitOnly for the current frame to be rem...
static void RevertDeny()
Causes any previous M:System.Security.CodeAccessPermission.Deny for the current frame to be removed a...
static void RevertAll()
Causes all previous overrides for the current frame to be removed and no longer in effect.
abstract IPermission Intersect(IPermission target)
When implemented by a derived class, creates and returns a permission that is the intersection of the...
SecurityAction
Specifies the security actions that can be performed using declarative security.
Provides information about, and means to manipulate, the current environment and platform....
Represents the XML object model for encoding security objects. This class cannot be inherited.
Defines the methods that convert permission object state to and from XML element representation.
Defines the underlying structure of all code access permissions.
override bool Equals(object obj)
Determines whether the specified T:System.Security.CodeAccessPermission object is equal to the curren...
abstract SecurityElement ToXml()
When overridden in a derived class, creates an XML encoding of the security object and its current st...
abstract bool IsSubsetOf(IPermission target)
When implemented by a derived class, determines whether the current permission is a subset of the spe...
MethodImplOptions
Defines the details of how a method is implemented.
override int GetHashCode()
Gets a hash code for the T:System.Security.CodeAccessPermission object that is suitable for use in ha...
Defines methods implemented by permission types.
static void RevertAssert()
Causes any previous M:System.Security.CodeAccessPermission.Assert for the current frame to be removed...
bool IsSubsetOf(IPermission target)
Determines whether the current permission is a subset of the specified permission.
The exception that is thrown when one of the arguments provided to a method is not valid.
void Demand()
Forces a T:System.Security.SecurityException at run time if all callers higher in the call stack have...
void Deny()
Prevents callers higher in the call stack from using the code that calls this method to access the re...
virtual IPermission Union(IPermission other)
When overridden in a derived class, creates a permission that is the union of the current permission ...
abstract void FromXml(SecurityElement elem)
When overridden in a derived class, reconstructs a security object with a specified state from an XML...
override string ToString()
Creates and returns a string representation of the current permission object.
void AddAttribute(string name, string value)
Adds a name/value attribute to an XML element.
Specifies that the class can be serialized.
void Assert()
Declares that the calling code can access the resource protected by a permission demand through the c...
The exception that is thrown when an invoked method is not supported, or when there is an attempt to ...
abstract IPermission Copy()
When implemented by a derived class, creates and returns an identical copy of the current permission ...
Manages the stack walk that determines whether all callers in the call stack have the required permis...
override string ToString()
Produces a string representation of an XML element and its constituent attributes,...