Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

WebRequest.Timeout Property

Gets or sets the length of time before the request times out.

[Visual Basic]
Public Overridable Property Timeout As Integer
[C#]
public virtual int Timeout {get; set;}
[C++]
public: __property virtual int get_Timeout();
public: __property virtual void set_Timeout(int);
[JScript]
public function get Timeout() : int;
public function set Timeout(int);

Property Value

The length of time, in milliseconds, until the request times out, or the value Timeout.Infinite to indicate that the request does not time out.

Exceptions

Exception Type Condition
NotSupportedException Any attempt is made to get or set the property, when the property is not overridden in a descendant class.

Remarks

The Timeout property indicates the length of time, in milliseconds, until the request times out and throws a WebException. The Timeout property affects only synchronous requests made with the GetResponse method. To time out asynchronous requests, use the Abort method.

Note   The WebRequest class is an abstract (MustInherit in Visual Basic) class. The actual behavior of WebRequest instances at run time is determined by the descendant class returned by the WebRequest.Create method. For more information about default values and exceptions, see the documentation for the descendant classes, such as HttpWebRequest and FileWebRequest.

Notes to Inheritors:  Descendant classes signal a timeout by throwing a WebException with the Status field set to WebExceptionStatus.Timeout. When Timeout is set to Timeout.Infinite the descendant class does not time out.

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework, Common Language Infrastructure (CLI) Standard

See Also

WebRequest Class | WebRequest Members | System.Net Namespace | HttpWebRequest.Timeout

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft