共用方式為


FileWebRequest.Method 屬性

定義

取得或設定用於請求的協定方法。 此屬性保留供日後使用。

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 = 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類別尚未使用該屬性。

適用於