Esempio n. 1
0
        private string BuildQueryStringForformatting(HttpRequest request)
        {
            string queryString = "";

            IQueryCollection requestQuery = request.Query;

            foreach (KeyValuePair <string, Microsoft.Extensions.Primitives.StringValues> item in requestQuery)
            {
                if (item.Key == "pageRef")
                {
                    queryString += "pageRef={0}&";
                }
                else
                {
                    queryString += $"{item.Key}={item.Value}&";
                }
            }

            if (!string.IsNullOrWhiteSpace(queryString))
            {
                queryString = queryString.Remove(queryString.Length - 1);
            }

            if (!queryString.Contains("pageRef"))
            {
                if (requestQuery.AnyWithNullCheck())
                {
                    queryString += "&pageRef={0}";
                }
                else
                {
                    queryString += "pageRef={0}";
                }
            }

            return(queryString);
        }