System.Net.Browser.PolicyBasedWebRequest.EndGetResponse C# (CSharp) Method

EndGetResponse() public method

public EndGetResponse ( IAsyncResult asyncResult ) : WebResponse
asyncResult IAsyncResult
return WebResponse
		public override WebResponse EndGetResponse (IAsyncResult asyncResult)
		{
			try {
				CheckProtocolViolation ();

				if (async_result != asyncResult)
					throw new ArgumentException ("asyncResult");

				if (aborted) {
					throw new WebException ("Aborted", WebExceptionStatus.RequestCanceled);
				}

				// we could already have an exception waiting for us
				if (async_result.HasException)
					throw async_result.Exception;

				if (!async_result.IsCompleted)
					async_result.AsyncWaitHandle.WaitOne ();

				// (again) exception could occur during the wait
				if (async_result.HasException)
					throw async_result.Exception;

				response = async_result.Response;
			}
			finally {
				async_result.Dispose ();
			}

			return response;
		}