Solucionando problemas de exceções: System.Security.SecurityException

A SecurityException exceção é lançada quando é detectado um erro de segurança.

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, armazenamentos isolados.

  • Se o uso de OpenFileDialog , use o OpenFile método para abrir ou salvar um arquivo.
    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 Solucionando problemas de interoperabilidade (Visual Basic).

  • Use safe windows.
    O UIPermissionWindow enumeração Especifica o tipo do windows que código tem permissão para usar.

  • Permitir que os usuários imprimirem através do PrintDialog componente.
    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 Considerações de segurança específicas para soluções do Office.

  • 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 Configurando a diretiva de segurança usando Code Access Security Policy Tool (Caspol. exe).

Consulte também

Tarefas

Como: Use o Assistente de exceção

Referência

SecurityException

Conceitos

Visão geral de administração de diretiva de segurança