Beispiel #1
0
        protected override void IntializeRequestInfo(HttpRequest httpRequest)
        {
            // base method
            base.IntializeRequestInfo(httpRequest);

            AjaxRequest.CustomHeaders = ExtractAJAXHeader(_currentContext.Request);
            AJAXInfo _AJAXInfo = GetAJAXInfo(_currentContext.Request.Params);

            // validate url
            if (string.IsNullOrEmpty(RequestInfo.RequestUrl))
            {
                LastErrorMessage = "Invalid AJAX headers.";
                LastStatus       = LastStatus.Error;
                return;
            }

            AjaxRequest.Username = _AJAXInfo.UserName;
            AjaxRequest.Password = _AJAXInfo.Password;

            RequestInfo.SetContentType(GetContentTypeInCollection(AjaxRequest.CustomHeaders, _DefaultContentType));
            RequestInfo.RedirectedFrom = GetRequestReferer(
                AjaxRequest.CustomHeaders,
                _currentContext.Request,
                Consts.BackEndConenction.ASProxyProjectUrl);
        }
Beispiel #2
0
        private AJAXInfo GetAJAXInfo(NameValueCollection queryString)
        {
            AJAXInfo result = new AJAXInfo();
            string   query;


            // Get requested url
            // We are using "ajaxurl" intead of simple "url", because some implementations of ajax use "url"
            // and that causes some issues.
            string url = queryString[Consts.Query.AjaxUrlAddress];

            // if url is provided
            if (!string.IsNullOrEmpty(url))
            {
                bool tmpBool = false;

                string decode = queryString[Consts.Query.Decode];
                if (!string.IsNullOrEmpty(decode))
                {
                    try
                    {
                        tmpBool = Convert.ToBoolean(Convert.ToInt32(decode));
                    }
                    catch
                    {
                        tmpBool = false;
                    }
                }

                // If url is encoded, decode it
                if (tmpBool)
                {
                    url = UrlProvider.DecodeUrl(url);
                }

                RequestInfo.RequestUrl = url;
            }

            if (UrlProvider.GetRequestQuery(queryString, "pas", out query))
            {
                try
                {
                    result.Password = UrlProvider.DecodeUrl(query);
                }
                catch
                {
                    result.Password = null;
                }
            }

            if (UrlProvider.GetRequestQuery(queryString, "use", out query))
            {
                try
                {
                    result.UserName = UrlProvider.DecodeUrl(query);
                }
                catch
                {
                    result.UserName = null;
                }
            }

            return(result);
        }
Beispiel #3
0
        private AJAXInfo GetAJAXInfo(NameValueCollection queryString)
        {
            AJAXInfo result = new AJAXInfo();
            string query;


            // Get requested url
            // We are using "ajaxurl" intead of simple "url", because some implementations of ajax use "url"
            // and that causes some issues.
            string url = queryString[Consts.Query.AjaxUrlAddress];

            // if url is provided
            if (!string.IsNullOrEmpty(url))
            {
                bool tmpBool = false;

                string decode = queryString[Consts.Query.Decode];
                if (!string.IsNullOrEmpty(decode))
                {
                    try
                    {
                        tmpBool = Convert.ToBoolean(Convert.ToInt32(decode));
                    }
                    catch
                    {
                        tmpBool = false;
                    }
                }

                // If url is encoded, decode it
                if (tmpBool)
                    url = UrlProvider.DecodeUrl(url);

                RequestInfo.RequestUrl = url;
            }

            if (UrlProvider.GetRequestQuery(queryString, "pas", out query))
            {
                try
                {
                    result.Password = UrlProvider.DecodeUrl(query);
                }
                catch
                {
                    result.Password = null;
                }
            }

            if (UrlProvider.GetRequestQuery(queryString, "use", out query))
            {
                try
                {
                    result.UserName = UrlProvider.DecodeUrl(query);
                }
                catch
                {
                    result.UserName = null;
                }
            }

            return result;
        }