WebPermission コンストラクタ ()とは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > WebPermission コンストラクタ ()の意味・解説 

WebPermission コンストラクタ ()


WebPermission コンストラクタ (NetworkAccess, Regex)

指定した URI 正規表現対すアクセス権指定して、WebPermission クラス新しインスタンス初期化します。

名前空間: System.Net
アセンブリ: System (system.dll 内)
構文構文

解説解説
使用例使用例

指定した System.Text.RegularExpressions.Regex に対す接続を持つ WebPermission新しインスタンス作成する例を次に示します

'  Creates an instance of 'Regex' that accepts all  URL's containing
 the host fragment 'www.contoso.com'.
Dim myRegex As New Regex("http://www\.contoso\.com/.*")
  
   ' Creates a 'WebPermission' that gives the permissions to all the
 hosts containing same host fragment.
   Dim myWebPermission As New
 WebPermission(NetworkAccess.Connect, myRegex)
   
  '  Checks all callers higher in the call stack have been granted the
 permission.
  myWebPermission.Demand()

 // Create an instance of 'Regex' that accepts all  URL's containing
 the host 
 // fragment 'www.contoso.com'.
 Regex myRegex = new Regex(@"http://www\.contoso\.com/.*");

// Create a WebPermission that gives the permissions to all the hosts
 containing 
// the same fragment.
WebPermission myWebPermission = new WebPermission(NetworkAccess.Connect
,myRegex);
   
// Checks all callers higher in the call stack have been granted the
 permission.
myWebPermission.Demand();
 
// Create an instance of 'Regex' that accepts all URL's containing the
 host
// fragment 'www.contoso.com'.
Regex^ myRegex = gcnew Regex( "http://www.contoso.com/.*"
 );

// Create a WebPermission that gives the permissions to all the hosts
 containing
// the same fragment.
WebPermission^ myWebPermission = gcnew WebPermission( NetworkAccess::Connect,myRegex
 );

// Checks all callers higher in the call stack have been granted the
 permission.
myWebPermission->Demand();
// Create an instance of 'Regex' that accepts all  URL's containing
 
// the host fragment 'www.contoso.com'.
Regex myRegex = new Regex("http://www\\.contoso\\.com/.*");
// Create a WebPermission that gives the permissions to all the hosts
 
// containing the same fragment.
WebPermission myWebPermission = new WebPermission(NetworkAccess.
    Connect, myRegex);
// Checks all callers higher in the call stack have been granted the
 
// permission.
myWebPermission.Demand();
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

WebPermission コンストラクタ (NetworkAccess, String)

指定した URI に対して指定したアクセス権を持つ WebPermission クラス新しインスタンス初期化します。

名前空間: System.Net
アセンブリ: System (system.dll 内)
構文構文

例外例外
例外種類条件

ArgumentNullException

uriStringnull 参照 (Visual Basic では Nothing) です。

解説解説
使用例使用例

指定した URI対す接続を持つ WebPermission新しインスタンス作成する例を次に示します

' Create a WebPermission.instance.
Dim myWebPermission1 As New
 WebPermission(NetworkAccess.Connect, "http://www.contoso.com/default.htm")
myWebPermission1.Demand()

// Create a WebPermission.instance.
WebPermission myWebPermission1 = new WebPermission(NetworkAccess.Connect
,"http://www.contoso.com/default.htm");
myWebPermission1.Demand();

// Create a WebPermission::instance.
WebPermission^ myWebPermission1 = gcnew WebPermission( NetworkAccess::Connect,"http://www.contoso.com/default.htm"
 );
myWebPermission1->Demand();
// Create a WebPermission.instance.
WebPermission myWebPermission1 = new WebPermission(
    NetworkAccess.Connect, "http://www.contoso.com/default.htm");
myWebPermission1.Demand();
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

WebPermission コンストラクタ (PermissionState)

すべての要求を渡すか、すべての要求失敗させる WebPermission クラス新しインスタンス作成します

名前空間: System.Net
アセンブリ: System (system.dll 内)
構文構文

Public Sub New ( _
    state As PermissionState _
)
Dim state As PermissionState

Dim instance As New WebPermission(state)
public WebPermission (
    PermissionState state
)
public:
WebPermission (
    PermissionState state
)
public WebPermission (
    PermissionState state
)
public function WebPermission (
    state : PermissionState
)

パラメータ

state

PermissionState 値。

解説解説

state パラメータの値は、PermissionState.None または PermissionState.Unrestricted で、それぞれすべてのセキュリティ変数へのアクセスを完全に制限するか、完全に無制限にます。PermissionState.None指定すると、AddPermission を使用して個別URIアクセス与えることができます

使用例使用例

WebPermissionインスタンス作成し特定の URLアクセス権与える例を次に示します

' Create a WebPermission instance.  
Dim myWebPermission1 As New
 WebPermission(PermissionState.None)

' Allow access to the first set of URL's.
myWebPermission1.AddPermission(NetworkAccess.Connect, "http://www.microsoft.com/default.htm")
myWebPermission1.AddPermission(NetworkAccess.Connect, "http://www.msn.com")

' Check whether all callers higher in the call stack have been granted
 the permissionor not.
myWebPermission1.Demand()

// Create a WebPermission instance.  
WebPermission myWebPermission1 = new WebPermission(PermissionState.None);

// Allow access to the first set of URL's.
myWebPermission1.AddPermission(NetworkAccess.Connect,"http://www.microsoft.com/default.htm");
myWebPermission1.AddPermission(NetworkAccess.Connect,"http://www.msn.com");

// Check whether all callers higher in the call stack have been granted
 the permissionor not.
myWebPermission1.Demand();

// Create a WebPermission instance.
WebPermission^ myWebPermission1 = gcnew WebPermission( PermissionState::None );

// Allow access to the first set of URL's.
myWebPermission1->AddPermission( NetworkAccess::Connect, "http://www.microsoft.com/default.htm"
 );
myWebPermission1->AddPermission( NetworkAccess::Connect, "http://www.msn.com"
 );

// Check whether all callers higher in the call stack have been granted
 the permissionor not.
myWebPermission1->Demand();
// Create a WebPermission instance.  
WebPermission myWebPermission1 = new WebPermission(PermissionState.None);
// Allow access to the first set of URL's.
myWebPermission1.AddPermission(NetworkAccess.Connect,
    "http://www.microsoft.com/default.htm");
myWebPermission1.AddPermission(NetworkAccess.Connect,
    "http://www.msn.com");
// Check whether all callers higher in the call stack have been granted
// the permissionor not.
myWebPermission1.Demand();
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
WebPermission クラス
WebPermission メンバ
System.Net 名前空間
Unrestricted

WebPermission コンストラクタ




英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「WebPermission コンストラクタ ()」の関連用語

WebPermission コンストラクタ ()のお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



WebPermission コンストラクタ ()のページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2025 Microsoft.All rights reserved.

©2025 GRAS Group, Inc.RSS