I have an application that creates many web requests to tag news pages on the web site (I have many people Web sites have been tested for some time) After some time I found out that the application is slow in bringing the html source, so I found out that HTTP fails to get the web resonance response. I only post the function that it works.
Get the public PageFet reference () {PageFetchResult fetchResult = new PageFetchResult (); Try {HttpWebRequest req = (HttpWebRequest) HttpWebRequest.Create (URLAddress); HttpWebResponse resp = (HttpWebResponse) req.GetResponse (); Uri requested = new URI (urlres); URI reply URI = resp.ResponseUri; If (Uri.Ellols (requested URI, answerIII)) {string result HTML = ""; Byte [] reqHTML = ResponseAsBytes (resp); If (! String.IsNullOrEmpty (fetchingEncoding)) results HTML = encoding GetEncoding (Fencing Encoding). GetString (Reic HTML); Else if (! String.IsNullOrEmpty (resp.CharacterSet)) Results HTML = Encoding GetEncoding (resp.CharacterSet) .GetString (reqHTML); Resp.Close (); FetchResult.IsOK = True; FetchResult.ResultHTML = Result HTML; } And {URLADRES = RESPONSORIES. AbsoluteURI; RelayPageCount ++; If (relayPageCount> 5) {fetchResult.IsOK = false; FetchResult.ErrorMessage = "Maximum page redirection happened."; Return fetch result; } Return (); }} Hold (Exception preceding) {fetchResult.IsOK = false; FetchResult.ErrorMessage = ex.Message; } Return Fetch Results; }
appreciate any solution
received function Is called recursively and always makes HttpWebRequest, but only when the url is matching is released. You have to stop the request and feedback in other details.
Comments
Post a Comment