Exemple #1
0
        /// <summary>invoked for derived classes to cleanup before callback is invoked</summary>
        protected override void CompletedRequest()
        {
            Debug.Assert(this.responseMessage != null || this.Failure != null, "should have response or exception");
            if (this.responseMessage != null)
            {
                // Can't use DataServiceContext.HandleResponse as this request didn't necessarily go to our server
                //   the MR could have been served by arbitrary server.
                InvalidOperationException failure = null;
                if (!WebUtil.SuccessStatusCode((HttpStatusCode)this.responseMessage.StatusCode))
                {
                    failure = SaveResult.GetResponseText(
                        this.responseMessage.GetStream,
                        (HttpStatusCode)this.responseMessage.StatusCode);
                }

                if (failure != null)
                {
                    // we've cached off what we need, headers still accessible after close
                    WebUtil.DisposeMessage(this.responseMessage);
                    this.HandleFailure(failure);
                }
            }
        }