want download only last line of a file in url using C# -
want download last line of file in url using c#
is possible or should download whole file last line.
when request url gives text update every 5 minute.
can download last line url?
well, achieve you're asking, need know exact byte range of last line in file... unlikely know ahead of time.
the server you're making request need support functionality. can find out whether or not looking @ headers of response include header accept-ranges: bytes
here's how make partial content request...
httpwebrequest request = (httpwebrequest)webrequest.create("http://example.com"); request.automaticdecompression = decompressionmethods.gzip | decompressionmethods.deflate; request.addrange(0, 599); using (httpwebresponse response = (httpwebresponse)request.getresponse()) using (stream stream = response.getresponsestream()) using (memorystream memorystream = new memorystream()) { stream.copyto(memorystream); memorystream.seek(0, seekorigin.begin); console.writeline ("stream size in bytes: {0}", memorystream.length); while (memorystream.position != memorystream.length) { console.write (convert.tochar(memorystream.readbyte())); } }