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); }
/// <summary> /// Initializes the request info. This method should be called when /// Initializing the class directly from the request. /// </summary> protected virtual void IntializeRequestInfo(HttpRequest httpRequest) { // If Modified Since // BUG: v5beta4 custom headers doesn't support at this moment // RequestInfo.CustomHeaders = GetHeadersFromRequest(httpRequest); RequestInfo.IfModifiedSince = GetIfModifiedSinceHeader(httpRequest); bool tmpBool = false; // Get requested url string url = httpRequest.QueryString[Consts.Query.UrlAddress]; // if url is provided if (!string.IsNullOrEmpty(url)) { string decode = httpRequest.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 = UrlProvider.CorrectInputUrl(url); } url = httpRequest.QueryString[Consts.Query.Redirect]; if (!string.IsNullOrEmpty(url)) { // If url is encoded, decode it if (tmpBool) { url = UrlProvider.DecodeUrl(url); } RequestInfo.RedirectedFrom = url; } // Get request post method state string reqMethod; if (UrlProvider.GetRequestQuery(httpRequest.QueryString, Consts.Query.WebMethod, out reqMethod)) { //RequestInfo.RequestMethod = WebMethods.ValidateMethod(reqMethod, WebMethods.DefaultMethods.GET); RequestInfo.RequestMethod = WebMethods.OmitInvalidCharacters(reqMethod); } else { RequestInfo.RequestMethod = WebMethods.GET; } }