Condividi tramite


How to: Set Custom Permissions for a ClickOnce Application

Although you can deploy a ClickOnce application with default permissions, it is a good practice to restrict the application to the specific permissions that it needs to operate properly. You can do this by customizing the security permissions on the Security page of the Project Designer.

Note

You can analyze your application to determine which permissions it needs by running the Permission Calculator tool. For more information, see How to: Determine the Permissions for a ClickOnce Application.

To exclude or include permissions in a security zone

  1. With a project selected in Solution Explorer, on the Project menu, click Properties.

  2. Click the Security tab.

  3. Select the Enable ClickOnce Security Settings check box.

  4. Select the This is a partial trust application option button.

    The controls in the ClickOnce security permissions section are enabled.

  5. Select a security zone from the Zone your application will be installed from drop-down list.

    The Permissions required by the application table will be updated with no permissions included.

  6. In the Permissions required by the application table, select the row for the permission that you want to modify, then choose Exclude or Include from the dropdown list in the Settings column.

    Any permission that has been modified will be displayed in bold text in the Permission column.

    Note

    Including a permission that is not part of the default permission set for the zone from which the application is deployed will cause the end user to be prompted to grant permission at install time. A network administrator can configure network policy so that users are not prompted when installing an application from a trusted source. For more information, see Signing ClickOnce Manifests.

To customize a permission

  1. With a project selected in Solution Explorer, on the Project menu, click Properties.

  2. Click the Security tab.

  3. Select the Enable ClickOnce Security Settings check box.

  4. Select the This is a partial trust application option button.

    The controls in the ClickOnce security permissions section are enabled.

  5. Select a security zone from the Zone your application will be installed from drop-down list.

  6. In the Permissions required by the application table, select the row for the permission that you want to modify, make sure that it is included, and then click the Properties button.

    A Permission Settings dialog box is displayed. The options for customizing the permission vary by permission.

See Also

Tasks

How to: Determine the Permissions for a ClickOnce Application

Concepts

Code Access Security for ClickOnce Applications

ClickOnce Deployment and Security

ClickOnce Deployment Overview

Other Resources

Securing ClickOnce Applications