FileWebRequest.Method 屬性

定義

取得或設定要求所使用的通訊協定 (Protocol) 方法。 這個屬性保留給未來的版本使用。

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

屬性值

這個要求中要使用的通訊協定方法。

例外狀況

此方法無效。

-或-

不支援此方法。

-或-

指定多個方法。

範例

下列程式代碼範例會設定用於要求的通訊協定方法。 請參閱 類別中 FileWebRequest 的完整範例。

// Create a Uri object.
Uri^ myUrl = gcnew Uri( String::Format( "file://{0}", fileName ) );

// Create a FileWebRequest object.
myFileWebRequest = dynamic_cast<FileWebRequest^>(WebRequest::CreateDefault( myUrl ));

// Set the timeout to the value selected by the user.
myFileWebRequest->Timeout = timeout;

// Set the Method property to POST
myFileWebRequest->Method = "POST";
// Create a Uri object.
Uri myUrl = new Uri ("file://" + fileName);

// Create a FileWebRequest object.
myFileWebRequest = (FileWebRequest)WebRequest.CreateDefault (myUrl);

// Set the time-out to the value selected by the user.
myFileWebRequest.Timeout = timeout;

// Set the Method property to POST
myFileWebRequest.Method = "POST";
' Create a Uri object.to access the file requested by the user. 
Dim myUrl As New Uri("file://" + fileName)

' Create a FileWebRequest object.for the requeste file.
myFileWebRequest = CType(WebRequest.CreateDefault(myUrl), FileWebRequest)

' Set the time-out to the value selected by the user.
myFileWebRequest.Timeout = timeout

' Set the Method property to POST  
myFileWebRequest.Method = "POST"

備註

類別 Method 目前不會使用 FileWebRequest 屬性。

適用於