/// <summary> /// Parses the query string. /// </summary> /// <param name="qs">The query string.</param> /// <param name="target">The dictionary target.</param> private static void ParseQueryString(string qs, IDictionary <string, string> target) { var fr = qs ?? string.Empty; if (fr.StartsWith("?", StringComparison.Ordinal)) { fr = fr.Substring(1); } foreach (var frag in fr.Split(new char[] { '&' }, StringSplitOptions.RemoveEmptyEntries)) { var parts = frag.Split(new char[] { '=' }, 2, StringSplitOptions.RemoveEmptyEntries); target[QueryStringSerializer.UnescapeDataString(parts[0])] = parts.Length == 1 ? null : QueryStringSerializer.UnescapeDataString(parts[1]); } }
/// <summary> /// Unescapes the string, removing escaped characters. /// </summary> /// <returns>The unescaped string.</returns> /// <param name="input">The escaped string.</param> public static string UnescapeString(string input) { return(QueryStringSerializer.UnescapeDataString(input)); }