Ole Albers
Ole Albers

Reputation: 9305

ReadwriteTimeout in FileWebRequest

I use the following code to increase the timeout from a webrequest:

_timeout=150000;
protected override WebRequest GetWebRequest(Uri uri)
{
    WebRequest request = base.GetWebRequest(uri);
    request.Timeout = _timeout;
    if (request is HttpWebRequest) ((HttpWebRequest)request).ReadWriteTimeout = request.Timeout;
    return request;
}

this works fine for http*:// - Uris But when I have a file:// - uri the WebRequest isn't a HttpWebRequest but a FileWebRequest. Now my problem is: A FileWebRequest does not have a ReadWriteTimeout-Property. How can this be achieved in FileWebRequests?

(update) As you can see on my example, I already use the Timeout-Property but this is not the property I am looking for.

Upvotes: 0

Views: 84

Answers (1)

SteppingRazor
SteppingRazor

Reputation: 1272

Isn't the Timeout property the one you are looking for? FileWebRequest - MSDN (on the bottom of the page there is even an example with the Timeout)

Upvotes: 1

Related Questions