Example #1
0
 public override void Skip()
 {
     if (this.disposed)
     {
         throw new ObjectDisposedException(null);
     }
     try
     {
         this.streamException = null;
         if (this.httpResponse != null)
         {
             this.httpResponse.Close();
             this.httpResponse       = null;
             this.httpResponseStream = null;
         }
     }
     catch (XmlaStreamException)
     {
         throw;
     }
     catch (IOException innerException)
     {
         throw new XmlaStreamException(innerException);
     }
 }
Example #2
0
        private void GetResponseStream()
        {
            if (this.outdatedVersion)
            {
                throw new AdomdConnectionException(XmlaSR.Connection_WorkbookIsOutdated);
            }
            if (this.httpResponseStream == null)
            {
                try
                {
                    if (this.logonWindowsIdentity != null)
                    {
                        using (WindowsIdentity current = WindowsIdentity.GetCurrent())
                        {
                            if (this.logonWindowsIdentity.User != current.User)
                            {
                                //using (this.logonWindowsIdentity.Impersonate())
                                //{
                                //	this.httpResponse = (HttpWebResponse)this.httpRequest.GetResponse();
                                //	goto IL_88;
                                //}
                            }
                            this.httpResponse = (HttpWebResponse)this.httpRequest.GetResponse();
IL_88:
                            goto IL_AA;
                        }
                    }
                    this.httpResponse = (HttpWebResponse)this.httpRequest.GetResponse();
IL_AA:
                    int statusCode = (int)this.httpResponse.StatusCode;
                    if (statusCode >= 300 && statusCode <= 399)
                    {
                        ASAzureUtility.ClustersCache.Invalidate();
                        throw new AdomdConnectionException(XmlaSR.Connection_AnalysisServicesInstanceWasMoved);
                    }
                    if (!this.hasASAzureHeaders)
                    {
                        string value = this.httpResponse.Headers["OutdatedVersion"];
                        if (!string.IsNullOrEmpty(value))
                        {
                            this.outdatedVersion = true;
                            throw new AdomdConnectionException(XmlaSR.Connection_WorkbookIsOutdated);
                        }
                    }
                    if (!this.hasASAzureHeaders)
                    {
                        this.RoutingToken = this.httpResponse.Headers["X-AS-Routing"];
                    }
                    this.DetermineNegotiatedOptions();
                }
                catch (WebException ex)
                {
                    if (ex.Response == null)
                    {
                        throw;
                    }
                    if (this.IsASAzure)
                    {
                        ASAzureUtility.ThrowConnectionException(ex);
                    }
                    HttpStatusCode statusCode2 = ((HttpWebResponse)ex.Response).StatusCode;
                    if (HttpStatusCode.InternalServerError == statusCode2)
                    {
                        this.httpResponse = (HttpWebResponse)ex.Response;
                        this.DetermineNegotiatedOptions();
                        Match match = HttpStream.contentTypeRegex.Match(this.httpResponse.ContentType);
                        if (!match.Success)
                        {
                            throw;
                        }
                        this.streamException = new XmlaStreamException(ex);
                    }
                    else
                    {
                        if (ex.Status == WebExceptionStatus.ProtocolError && statusCode2 == HttpStatusCode.Unauthorized)
                        {
                            throw new XmlaStreamException(ex, ConnectionExceptionCause.AuthenticationFailed);
                        }
                        throw;
                    }
                }
                finally
                {
                    this.httpRequestStream = null;
                }
                this.httpResponseStream = new BufferedStream(this.httpResponse.GetResponseStream(), XmlaClient.HttpStreamBufferSize);
            }
        }