Export (0) Print
Expand All

FileWebRequest.Method Property

Gets or sets the protocol method used for the request. This property is reserved for future use.

[Visual Basic]
Overrides Public Property Method As String
[C#]
public override string Method {get; set;}
[C++]
public: __property String* get_Method();
public: __property void set_Method(String*);
[JScript]
public override function get Method() : String;
public override function set Method(String);

Property Value

The protocol method to use in this request.

Remarks

The Method property is currently not used by the FileWebRequest class.

Example

[Visual Basic, C#, C++] The follolwing example sets the the protocol method used for the request. Refer to the complete example in the FileWebRequest class.

[Visual Basic] 
' 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"


[C#] 
// 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";

[C++] 
// Create a Uri object.
Uri* myUrl = new Uri(String::Format(S"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=S"POST";

[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button Language Filter in the upper-left corner of the page.

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

See Also

FileWebRequest Class | FileWebRequest Members | System.Net Namespace

Show:
© 2014 Microsoft