通过


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 类使用。

适用于