public ArcGISLegendResponse GetLegendInfo(string serviceUrl, ICredentials credentials = null) { _webRequest = CreateRequest(serviceUrl, credentials); var response = _webRequest.GetSyncResponse(_timeOut); _legendResponse = GetLegendResponseFromWebresponse(response); return _legendResponse; }
public static byte[] FetchImage(HttpWebRequest webRequest) { WebResponse webResponse = webRequest.GetSyncResponse(Timeout); if (webResponse == null) throw (new WebException("An error occurred while fetching tile", null)); if (webResponse.ContentType.StartsWith("image", StringComparison.OrdinalIgnoreCase)) { using (Stream responseStream = webResponse.GetResponseStream()) { return Utilities.ReadFully(responseStream); } } string message = ComposeErrorMessage(webResponse, webRequest.RequestUri.AbsoluteUri); throw (new WebResponseFormatException(message, null)); }
public static byte[] FetchImage(HttpWebRequest webRequest) { using (var webResponse = webRequest.GetSyncResponse(Timeout)) { if (webResponse == null) { throw (new WebException("An error occurred while fetching tile", null)); } using (Stream responseStream = webResponse.GetResponseStream()) { return Utilities.ReadFully(responseStream); } } }