Troubleshooting Exceptions: System.Security.SecurityException

A SecurityException exception is thrown when a security error is detected.

Associated Tips

  • Adjust the permission level of the assembly via the property page.
    For more information, see SqlPermissionLevel.

  • Store application data in isolated storage.
    Isolated storage is a data storage that provides isolation and safety by defining standardized ways of associating code with saved data. For more information, Isolated Storage.

  • If using OpenFileDialog , use the OpenFile method to open or save a file.
    This allows the application to perform in a partial-trust situation.

  • Make sure the application is reading and writing to existing event logs on the local computer.
    The application may not have sufficient permissions to create logs on or write to non-local computers.

  • If calling unmanaged libraries, use equivalent managed libraries.
    An equivalent API may exist in the Framework. For more information, see Troubleshooting Interoperability (Visual Basic).

  • Use safe windows.
    The UIPermissionWindow enumeration specifies the type of windows that code is allowed to use.

  • Allow users to print through the PrintDialog component.
    This allows the application to perform in a partial-trust situation. For more information, see PrintDialog.

  • Print to the default printer.
    This allows the application to perform in a partial-trust situation. You may be trying to access a printer to which you do not have rights.

  • Retrieve data from the same Web server from which it was deployed.
    This allows the application to perform in a partial-trust situation.

  • When deploying an Office solution, check to make sure you have fulfilled all necessary security requirements.
    For more information see Specific Security Considerations for Office Solutions.

  • If an assembly implementing the custom security object references other assemblies, add the referenced assemblies to the full trust assembly list.
    For more information, see Caspol.exe (Code Access Security Policy Tool) and Configuring Security Policy Using the Code Access Security Policy Tool (Caspol.exe).

See Also

Tasks

How to: Use the Exception Assistant

Reference

SecurityException

Concepts

Security Policy Administration Overview