Compartilhar via


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, see 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.
  • 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. For more information, see Deploying XML Web Services.

See Also

Tasks

How to: Find Out More About an Exception with the Exception Assistant

Reference

Visual J# Exception Handling for the Debugger
Visual J# Exception Hierarchies
SecurityException

Concepts

Security Policy Administration Overview