FileWebRequest.Method FileWebRequest.Method FileWebRequest.Method FileWebRequest.Method Property

定义

获取或设置用于请求的协议方法。Gets or sets the protocol method used for the request. 保留此属性供将来使用。This property is reserved for future use.

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

属性值

在此请求中使用的协议方法。The protocol method to use in this request.

异常

此方法无效。The method is invalid.

-or-

不支持此方法。The method is not supported.

-or-

指定了多个方法。Multiple methods were specified.

示例

下面的代码示例设置用于请求的协议方法。The following code example sets the protocol method used for the request. 请参阅FileWebRequest类中的完整示例。Refer to the complete example in the FileWebRequest class.

// 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"

注解

FileWebRequest类当前未使用此Method属性。The Method property is currently not used by the FileWebRequest class.

适用于