stream - How can I only receive part of an HTTP web response in C# -
i'm wondering if there way in c# & read http web response point. example:
public static void example() { httpwebrequest request = (httpwebrequest)webrequest.createhttp("http://www.example.com/"); using(httpwebresponse response = (httpwebresponse)request.getresponse()) { using(stream responsestream = response.getresponsestream()) { using(streamreader responsereader = new streamreader(responsestream, system.text.encoding.utf8)) { string line; while((line = responsereader.readline()) != null) { if(line.contains("stop!")) { break; } } } } } } this stop stream reading, response still whole page instead of "stop!" found.
Comments
Post a Comment