/// <include file='doc\ClientProtocol.uex' path='docs/doc[@for="WebClientProtocol.GetWebResponse"]/*' /> /// <devdoc> /// <para> /// Gets the <see cref='System.Net.WebResponse'/> from the given request by calling /// GetResponse(). Derived classes can override this method to do additional /// processing on the response instance. /// </para> /// </devdoc> protected virtual WebResponse GetWebResponse(WebRequest request) { WebResponse response = null; try { response = request.GetResponse(); } catch (WebException e) { if (e.Response == null) { throw e; } else { response = e.Response; } } finally { if (debugger != null) { debugger.NotifyClientCallReturn(response); } } return(response); }
/// <include file='doc\ClientProtocol.uex' path='docs/doc[@for="WebClientProtocol.GetWebResponse"]/*' /> /// <devdoc> /// <para> /// Gets the <see cref='System.Net.WebResponse'/> from the given request by calling /// GetResponse(). Derived classes can override this method to do additional /// processing on the response instance. /// </para> /// </devdoc> protected virtual WebResponse GetWebResponse(WebRequest request) { TraceMethod caller = Tracing.On ? new TraceMethod(this, "GetWebResponse") : null; WebResponse response = null; try { if (Tracing.On) { Tracing.Enter("WebRequest.GetResponse", caller, new TraceMethod(request, "GetResponse")); } response = request.GetResponse(); if (Tracing.On) { Tracing.Exit("WebRequest.GetResponse", caller); } } catch (WebException e) { if (e.Response == null) { throw e; } else { if (Tracing.On) { Tracing.ExceptionCatch(TraceEventType.Error, this, "GetWebResponse", e); } response = e.Response; } } finally { #if !MONO if (debugger != null) { debugger.NotifyClientCallReturn(response); } #endif } return(response); }