Share via


WebBrowserPermissionLevel 列舉

定義

警告

Code Access Security is not supported or honored by the runtime.

指定 Web 瀏覽器的使用權限等級。

public enum class WebBrowserPermissionLevel
public enum WebBrowserPermissionLevel
[System.Obsolete("Code Access Security is not supported or honored by the runtime.", DiagnosticId="SYSLIB0003", UrlFormat="https://aka.ms/dotnet-warnings/{0}")]
public enum WebBrowserPermissionLevel
type WebBrowserPermissionLevel = 
[<System.Obsolete("Code Access Security is not supported or honored by the runtime.", DiagnosticId="SYSLIB0003", UrlFormat="https://aka.ms/dotnet-warnings/{0}")>]
type WebBrowserPermissionLevel = 
Public Enum WebBrowserPermissionLevel
繼承
WebBrowserPermissionLevel
屬性

欄位

None 0

無法將框架巡覽至 HTML 的 Web 瀏覽器。

Safe 1

可將框架安全巡覽至 HTML,但有數項限制的 Web 瀏覽器。

Unrestricted 2

可無限制地巡覽的 Web 瀏覽器。

範例

下列範例示範如何要求呼叫程式代碼具有不受限制的許可權,才能建立網頁瀏覽器控件。

[WebBrowserPermissionAttribute(SecurityAction.Demand, Level = WebBrowserPermissionLevel.Unrestricted)]
<WebBrowserPermissionAttribute(SecurityAction.Demand, Level:=WebBrowserPermissionLevel.Unrestricted)>
Public Sub Method03()
End Sub

備註

警告

程式代碼啟用安全性 (CAS) 在所有版本的 .NET Framework 和 .NET 中已被取代。 最新版本的 .NET 不接受 CAS 批注,並在使用 CAS 相關 API 時產生錯誤。 開發人員應尋求替代方案來完成安全性工作。

使用此列舉來設定 Level 類別的 WebBrowserPermission 屬性。

安全許可權等級會限制下列網頁瀏覽器作業。

  • 無法透過網頁瀏覽器控制項建立彈出視窗。

  • 網頁瀏覽器控件只能巡覽至其原點網站。

  • 網頁瀏覽器控件的安全性設定會減少。

適用於