現在のサイトを取得または設定します。
Public Property Site As String
[C#]
public string Site {get; set;}
[C++]
public: __property String* get_Site();public: __property void set_Site(String*);
[JScript]
public function get Site() : String;public function set Site(String);
プロパティ値
現在のサイト。
解説
サイト ID は、HTTP、HTTPS、および FTP のプロトコルの付いた URL からのコードだけで定義されます。URL のプロトコルの後ろの "//" から次の "/" までの間に文字列がある場合は、その文字列がサイトを表します。たとえば、URL https://www.fourthcoffee.com/process/grind.htm の www.fourthcoffee.com がサイトです。ポート番号は除外されます。URL が https://www.fourthcoffee.com:8000/ の場合、サイトは www.fourthcoffee.com:8000 ではなく www.fourthcoffee.com になります。
サイトには、完全に一致する文字列か、ドット区切り文字の前にワイルドカード ("*") を付けた文字列を指定できます。たとえば、サイト名として文字列 *.fourthcoffee.com を指定すると、fourthcoffee.com と www.fourthcoffee.com の両方と一致します。ワイルドカードを使用しない場合、正確に一致するサイト名だけが見つかります。サイト名として文字列 * を指定した場合、任意のサイトと一致しますが、サイト証拠のないコードとは一致しません。
使用例
' Union creates a new permission that is the union of the current permission
' and the specified permission.
Private Function UnionDemo() As Boolean
Dim returnCodeCode As Boolean = True
Dim site1, site2 As [String]
Dim successFlag As Boolean
Dim siteIdPerm1, siteIdPerm2, p3 As SiteIdentityPermission
Dim siteGen1 As New SiteGenerator()
Dim siteGen2 As New SiteGenerator()
siteGen1.ResetIndex()
While siteGen1.CreateSite(siteIdPerm1, site1, successFlag)
If siteIdPerm1 Is Nothing Or successFlag = False Then
GoTo ContinueWhile1
End If
siteGen2.ResetIndex()
Console.WriteLine("**************************************************************************")
While siteGen2.CreateSite(siteIdPerm2, site2, successFlag)
If siteIdPerm2 Is Nothing Or successFlag = False Then
GoTo ContinueWhile2
End If
Dim firstSite As [String] = IIf(site1 Is Nothing, "null", site1)
Dim secondSite As [String] = IIf(site2 Is Nothing, "null", site2)
Try
p3 = CType(siteIdPerm1.Union(siteIdPerm2), SiteIdentityPermission)
Dim thirdSite As [String] = IIf(p3.Site Is Nothing, "null", p3.Site.ToString())
If Not (p3 Is Nothing) Then
Console.WriteLine(("The union of " & firstSite & " and " & ControlChars.Lf & ControlChars.Tab & secondSite & " = " & ControlChars.Lf & ControlChars.Tab & thirdSite & ControlChars.Lf))
Else
Console.WriteLine(("The union of " & firstSite & " and " & ControlChars.Lf & ControlChars.Tab & secondSite & " = null." & ControlChars.Lf))
End If
Catch
' Expected exception, result of the union is null.
Console.WriteLine(("The union of " & firstSite & " and " & ControlChars.Lf & ControlChars.Tab & secondSite & " = null." & ControlChars.Lf))
End Try
ContinueWhile2:
End While
ContinueWhile1:
End While
Return returnCodeCode
End Function 'UnionDemo
[C#]
// Union creates a new permission that is the union of the current permission
// and the specified permission.
private bool UnionDemo()
{
bool returnCodeCode = true;
String site1,site2;
bool successFlag;
SiteIdentityPermission siteIdPerm1,siteIdPerm2,p3;
SiteGenerator siteGen1 = new SiteGenerator();
SiteGenerator siteGen2 = new SiteGenerator();
siteGen1.ResetIndex();
while(siteGen1.CreateSite(out siteIdPerm1, out site1, out successFlag))
{
if(siteIdPerm1 == null | successFlag == false) continue;
siteGen2.ResetIndex();
Console.WriteLine("**************************************************************************");
while(siteGen2.CreateSite(out siteIdPerm2, out site2, out successFlag)) {
if(siteIdPerm2 == null | successFlag == false) continue;
String firstSite = site1 == null ? "null" : site1;
String secondSite = site2 == null ? "null" : site2;
try
{
p3 = (SiteIdentityPermission)siteIdPerm1.Union(siteIdPerm2);
String thirdSite = p3.Site == null ? "null" : p3.Site;
if(p3 != null)
{
Console.WriteLine("The union of " + firstSite + " and \n\t" + secondSite + " = \n\t"
+ thirdSite + "\n");
}
else
{
Console.WriteLine("The union of " + firstSite + " and \n\t" + secondSite + " = null.\n");
}
}
catch
{
// Expected exception, result of the union is null.
Console.WriteLine("The union of " + firstSite + " and \n\t" + secondSite + " = null.\n");
}
}
}
return returnCodeCode;
}
[C++]
// Union creates a new permission that is the union of the current permission
// and the specified permission.
bool UnionDemo() {
bool returnCodeCode = true;
String* site1, *site2;
bool successFlag;
SiteIdentityPermission* siteIdPerm1, *siteIdPerm2, *p3;
SiteGenerator* siteGen1 = new SiteGenerator();
SiteGenerator* siteGen2 = new SiteGenerator();
siteGen1->ResetIndex();
while(siteGen1->CreateSite(&siteIdPerm1, &site1, &successFlag)) {
if (siteIdPerm1 == 0 || successFlag == false) continue;
siteGen2->ResetIndex();
Console::WriteLine(S"**************************************************************************");
while(siteGen2->CreateSite(&siteIdPerm2, &site2, &successFlag)) {
if (siteIdPerm2 == 0 || successFlag == false) continue;
String* firstSite = site1 == 0 ? S"null" : site1;
String* secondSite = site2 == 0 ? S"null" : site2;
try {
p3 = dynamic_cast<SiteIdentityPermission*>(siteIdPerm1->Union(siteIdPerm2));
String* thirdSite = p3->Site == 0 ? S"null" : p3->Site;
if (p3 != 0) {
Console::WriteLine(S"The union of {0} and \n\t{1} = \n\t{2}\n",
firstSite, secondSite, thirdSite);
} else {
Console::WriteLine(S"The union of {0} and \n\t{1} = null.\n", firstSite, secondSite);
}
} catch (Exception*) {
// Expected exception, result of the union is 0.
Console::WriteLine(S"The union of {0} and \n\t{1} = null.\n", firstSite, secondSite);
}
}
}
return returnCodeCode;
}
[JScript] JScript のサンプルはありません。Visual Basic、C#、および C++ のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン をクリックします。
必要条件
プラットフォーム: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 ファミリ
参照
SiteIdentityPermission クラス | SiteIdentityPermission メンバ | System.Security.Permissions 名前空間