Asserts that the calling code can access the resource identified by the current permission object, even if callers have not been granted permission to access the resource. Calling the Assert method stops the check on previous callers in the call chain. Therefore, even if previous callers do not have the requisite permissions, they can still access resources.
Warning: Because calling the Assert method removes the requirement that all code in the call chain must be granted permission to access the specified resource, it can open up security holes if used incorrectly or inappropriately. Therefore, it should be used with great caution.
[Visual Basic] Sub Assert() [C#] void Assert(); [C++] void Assert() = 0; [JScript] function Assert();
In order to assert permissions, code must be granted the SecurityPermission that represents the ability to call Assert.
An assertion is effective only if the code that calls Assert passes the security check for the permission that it is asserting. Also, code that calls Assert must have been granted the SecurityPermission; otherwise, a SecurityException is thrown.
A call to Assert is effective until the calling code returns to its caller or until a subsequent call to Assert, which renders the earlier assertion ineffective. Also, RevertAssert or RevertAll will remove a pending assert.
IStackWalk Interface | IStackWalk Members | System.Security Namespace