コード例 #1
0
ファイル: HttpFeedFactory.cs プロジェクト: GuiBGP/qdfeed
 public override IAsyncResult BeginDownloadXml(Uri feeduri, AsyncCallback callback)
 {
     try
     {
         var request = WebRequest.Create(feeduri) as HttpWebRequest;
         var requestState = new AsyncFeedRequestState { FeedUri = feeduri, OriginalRequest = request };
         return request.BeginGetResponse(callback, requestState);
     }
     /* Usually this means we encountered a 404 / 501 error of some sort. */
     catch (WebException ex)
     {
         throw new MissingFeedException(string.Format("Was unable to open web-hosted file {0}", feeduri.LocalPath), ex);
     }
 }
コード例 #2
0
 public override IAsyncResult BeginDownloadXml(Uri feeduri, AsyncCallback callback)
 {
     try
     {
         var request      = WebRequest.Create(feeduri) as HttpWebRequest;
         var requestState = new AsyncFeedRequestState {
             FeedUri = feeduri, OriginalRequest = request
         };
         return(request.BeginGetResponse(callback, requestState));
     }
     /* Usually this means we encountered a 404 / 501 error of some sort. */
     catch (WebException ex)
     {
         throw new MissingFeedException(string.Format("Was unable to open web-hosted file {0}", feeduri.LocalPath), ex);
     }
 }