Exemplo n.º 1
0
        private bool Redirect(StringCollectionEx requestHeader, string[] responseText, ref string method)
        {
            string location = ResponseHeader.Location;
            var    e        = new HttpRedirectEventArgs(requestHeader.ToArray(), statusCode, ResponseHeader, responseText, method,
                                                        false, false);
            string resourcePath = GetResourcePath();

            OnRedirecting(e);
            method = e.Method;
            if (e.Handled || StringUtils.IsEmpty(location))
            {
                return(e.CanRedirect);
            }
            url.Parse(Url.Url, location);
            if (StringUtils.IsEmpty(Url.AbsoluteUri))
            {
                return(false);
            }
            method = GetRedirectMethod(StatusCode, method);
            if (GetResourcePath().IndexOf(resourcePath) != 0)
            {
                var fieldList = new HeaderFieldList();
                HeaderFieldList.GetHeaderFieldList(0, requestHeader, fieldList);
                HeaderFieldList.RemoveHeaderField(requestHeader, fieldList, "Authorization");
            }
            return(true);
        }
Exemplo n.º 2
0
        protected virtual void OnRedirecting(HttpRedirectEventArgs e)
        {
            var handler = (HttpRedirectEventHandler)base.Events[redirecting];

            if (handler != null)
            {
                handler(this, e);
            }
        }