FtpWebRequest.ConnectionGroupName 屬性

定義

取得或設定連接群組的名稱,這個連接群組包含用來傳送目前要求的服務點。

public:
 virtual property System::String ^ ConnectionGroupName { System::String ^ get(); void set(System::String ^ value); };
public override string? ConnectionGroupName { get; set; }
public override string ConnectionGroupName { get; set; }
member this.ConnectionGroupName : string with get, set
Public Overrides Property ConnectionGroupName As String

屬性值

String 值,包含連接群組名稱。

例外狀況

由於已經在進行的要求,已為這個屬性指定新的值。

範例

下列程式代碼範例會擷取此屬性的值。

IWebProxy^ proxy = request->Proxy;
if ( proxy )
{
   Console::WriteLine( "Proxy: {0}", proxy->GetProxy( request->RequestUri ) );
}
else
{
   Console::WriteLine( "Proxy: (none)" );
}

Console::WriteLine( "ConnectionGroup: {0}", request->ConnectionGroupName == nullptr ? "none" : request->ConnectionGroupName );
IWebProxy proxy = request.Proxy;
if (proxy != null)
{
    Console.WriteLine("Proxy: {0}", proxy.GetProxy(request.RequestUri));
}
else
{
    Console.WriteLine("Proxy: (none)");
}

Console.WriteLine("ConnectionGroup: {0}",
    request.ConnectionGroupName == null ? "none" : request.ConnectionGroupName
);

備註

連接群組會將一組要求與特定連線或一組連線產生關聯。 只有在要求上的認證相同且要求指定連接組名時,連線群組中的連線只能由源自相同應用程式域的要求重複使用。 當要求未指定連接組名時,可以使用與連線群組無關之要求伺服器的任何現有連線。 當認證不相同時,會關閉現有的連線,而且必須重新驗證新的要求。

使用連線群組可以改善效能,因為這可讓使用者重複使用使用使用者認證驗證的連線。

呼叫、 或方法之後變更 ConnectionGroupName 屬性會導致InvalidOperationException例外狀況。BeginGetResponseGetResponseBeginGetRequestStreamGetRequestStream

適用於

另請參閱