c# - Different results when using WebRequest vs WebClient -
We have a text file that automatically generates and puts into the web server to read the file line by the work line And to record the records in the database. The following code is in C #:
WebRequest request = WebRequest.Create (url); WebResponse response = Request GetResponse (); Streamerdinder r = new streamerdidder (feedback gatesresponsstream ()); While (r.Peek ()> -1) {string s = r.ReadLine (). Trim (); // Insert a string in a DB} When I do this, I get the whole file 9000 - 10000 lines. On the other hand when I use the following, I get a small file (lower lines)
WebClient Client = new webclient (); Streamrider R = New Streamminder (Client.OpenArray (url)); While (r.Peek ()> -1) {string s = r.ReadLine (). Trim (); // Insert a string in a DB} Can anyone explain the difference? Why will the results be different? I was under the assumption that WebClient was the only cover of HTTP WebBurist.
Peak method, prepare a complete line for red color Guaranteed. I'm sure you are receiving partial lines (in fact breaking the existing stream position).
In fact
have you tried the method? I do not think that it is related to any of the two classes, but as a result you read how.
Comments
Post a Comment