NetCodeGroup.ResetConnectAccess 메서드
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
현재 코드 그룹에 대한 연결 액세스 정보를 모두 제거합니다.
public:
void ResetConnectAccess();
public void ResetConnectAccess ();
member this.ResetConnectAccess : unit -> unit
Public Sub ResetConnectAccess ()
예제
다음 코드 예제에서는 기본 코드 액세스 연결 규칙을 제거 하려면이 메서드를 호출 하는 방법을 보여 줍니다.
static void SetNetCodeGroupAccess()
{
String^ userPolicyLevel = "User";
// Locate the User policy level.
PolicyLevel^ level = nullptr;
System::Collections::IEnumerator^ ph =
System::Security::SecurityManager::PolicyHierarchy();
while(ph->MoveNext())
{
level = (PolicyLevel^)ph->Current;
if (level->Label == userPolicyLevel)
{
break;
}
}
if (level->Label != userPolicyLevel)
throw gcnew ApplicationException("Could not find User policy level.");
IMembershipCondition^ membership =
gcnew UrlMembershipCondition("http://www.contoso.com/*");
NetCodeGroup^ codeGroup = gcnew NetCodeGroup(membership);
// Delete default settings.
codeGroup->ResetConnectAccess();
// Create an object that represents access to the FTP scheme and
// default port.
CodeConnectAccess^ CodeAccessFtp =
gcnew CodeConnectAccess(Uri::UriSchemeFtp,
CodeConnectAccess::DefaultPort);
// Create an object that represents access to the HTTPS scheme
// and default port.
CodeConnectAccess^ CodeAccessHttps =
gcnew CodeConnectAccess(Uri::UriSchemeHttps,
CodeConnectAccess::DefaultPort);
// Create an object that represents access to the origin
// scheme and port.
CodeConnectAccess^ CodeAccessOrigin =
CodeConnectAccess::CreateOriginSchemeAccess
(CodeConnectAccess::OriginPort);
// Add connection access objects to the NetCodeGroup object.
codeGroup->AddConnectAccess(Uri::UriSchemeHttp, CodeAccessFtp);
codeGroup->AddConnectAccess(Uri::UriSchemeHttp, CodeAccessHttps);
codeGroup->AddConnectAccess(Uri::UriSchemeHttp, CodeAccessOrigin);
// Provide name and description information for caspol.exe tool.
codeGroup->Name = "ContosoHttpCodeGroup";
codeGroup->Description = "Code originating from contoso.com can" +
" connect back using the FTP or HTTPS.";
// Add the code group to the User policy's root node.
level->RootCodeGroup->AddChild(codeGroup);
// Save the changes to the policy level.
System::Security::SecurityManager::SavePolicy();
}
public static void SetNetCodeGroupAccess()
{
const string userPolicyLevel = "User";
// Locate the User policy level.
PolicyLevel level = null;
System.Collections.IEnumerator ph =
System.Security.SecurityManager.PolicyHierarchy();
while(ph.MoveNext())
{
level = (PolicyLevel)ph.Current;
if( level.Label == userPolicyLevel )
{
break;
}
}
if (level.Label != userPolicyLevel)
throw new ApplicationException("Could not find User policy level.");
IMembershipCondition membership =
new UrlMembershipCondition(@"http://www.contoso.com/*");
NetCodeGroup codeGroup = new NetCodeGroup(membership);
// Delete default settings.
codeGroup.ResetConnectAccess();
// Create an object that represents access to the FTP scheme and default port.
CodeConnectAccess a1 = new CodeConnectAccess(Uri.UriSchemeFtp, CodeConnectAccess.DefaultPort);
// Create an object that represents access to the HTTPS scheme and default port.
CodeConnectAccess a2 = new CodeConnectAccess(Uri.UriSchemeHttps, CodeConnectAccess.DefaultPort);
// Create an object that represents access to the origin scheme and port.
CodeConnectAccess a3 = CodeConnectAccess.CreateOriginSchemeAccess(CodeConnectAccess.OriginPort);
// Add connection access objects to the NetCodeGroup object.
codeGroup.AddConnectAccess(Uri.UriSchemeHttp, a1);
codeGroup.AddConnectAccess(Uri.UriSchemeHttp, a2);
codeGroup.AddConnectAccess(Uri.UriSchemeHttp, a3);
// Provide name and description information for caspol.exe tool.
codeGroup.Name = "ContosoHttpCodeGroup";
codeGroup.Description = "Code originating from contoso.com can connect back using the FTP or HTTPS.";
// Add the code group to the User policy's root node.
level.RootCodeGroup.AddChild(codeGroup);
// Save the changes to the policy level.
System.Security.SecurityManager.SavePolicy();
}
설명
이 메서드를 사용하여 시스템에서 제공하는 기본 연결 액세스 규칙을 제거합니다.
기본 규칙은 다음 표에 나와 있습니다.
구성표 | 규칙 |
---|---|
파일 | 원본 서버에 대한 연결 액세스는 허용되지 않습니다. |
http | 원본 포트를 사용하여 HTTP 및 HTTPS 액세스가 허용됩니다. |
https | 원본 포트를 사용하여 HTTPS 액세스가 허용됩니다. |