Resuming broken file download with FtpWebRequest class

When we are downloading a large file from ftp site and connection got broken in between, on next attempt you would be interested in downloading the rest of the file content instead of full file. FtpWebRequest class have a nice way to meet this requirement. You could use the FtpWebRequest.ContentOffset property to specify the starting position for file to download. See code example below

While playing around with this method (in VS2003, using the documentation from MSDN library CDs from April 2004), I noticed that the documentation for "HttpWebRequest.AddRange(int)" is either simply wrong, or stated in such an obscure way that I couldn’t get the truth out of it. The part of the remarks, where it describes the effect of positive versus negative arguments seems to be wrong for both cases.

The correct description is best given by an example:

In a request for a 1000 byte document:

AddRange(300) will return all bytes from byte 300 (bytes 300-999), that is: 700 bytes in total.

[this btw matches the given description for the negative range!]

AddRange(-300) will return the last 300 bytes (bytes 700-999), that is: 300 bytes in total.

It may be useful to refer to the correct section of the RFC in the docs. Also, the docs should mention that, if the Range request is successful, the return status will be 206 rather than 200, and the response will have a ‘Content-Range’ header that tells you what range exactly is returned. If a 200 response is returned, the Range request has been ignored and you got the full document instead.