CodeAccessPermission::revertAssert Method

Causes a previous call to the CodeAccessPermission.assert and CodeAccessPermission::assertMultiple methods to be removed and no longer in effect.

Syntax

client server public static void revertAssert()

Run On

Called

Remarks

When you have multiple calls to the assert method in the same calling code, you must call the revertAssert method between each call. Otherwise, the Infolog displays an error when you execute the code.

When you call the assert method only one time, or when you call the CodeAccessPermission::assertMultiple method, we recommend that you still call the revertAssert method after you invoke the protected API to limit the scope of the assert.

Examples

The following code example shows a call to the CodeAccessPermission::revertAssert method after the user calls the CodeAccessPermission.assert method and the AsciiIo class that is protected by a permission.

server static void main(Args args) 
{ 
    FileIoPermission _perm; 
    AsciiIo a; 

     
    _perm = new FileIoPermission("c:\\File.txt",'r'); 
    _perm.assert(); 
  
    //invoke protected API 
    a = new AsciiIo("c:\\File.txt",'r'); 
     
    // Optionally call revertAssert() to limit scope of assert. 
    CodeAccessPermission::revertAssert(); 
}

See Also

CodeAccessPermission Class

CodeAccessPermission Class