/// <summary> /// Returns a hashtable of the query parameters parsed from a URL /// </summary> /// <param name="url">The url from which to get the query parameters (Note: This will be fooled /// by html escaped strings such as & in the url)</param> /// <returns>A hashtable of the parameters</returns> public static Hashtable GetQueryParams(string url) { Hashtable queryParams = new DefaultHashtable(new DefaultHashtable.DefaultValuePump(DefaultHashtable.ArrayListDefault)); Uri uri = new Uri(url); string trimmedUrl = uri.Query.TrimStart('?'); string[] pairs = trimmedUrl.Split('&'); foreach (string pair in pairs) { string[] splitPairs = pair.Split('='); if (splitPairs.Length == 2) { ((ArrayList)queryParams[splitPairs[0]]).Add(splitPairs[1]); } } return(queryParams); }
/// <summary> /// Returns a hashtable of the query parameters parsed from a URL /// </summary> /// <param name="url">The url from which to get the query parameters (Note: This will be fooled /// by html escaped strings such as & in the url)</param> /// <returns>A hashtable of the parameters</returns> public static Hashtable GetQueryParams(string url) { Hashtable queryParams = new DefaultHashtable(new DefaultHashtable.DefaultValuePump(DefaultHashtable.ArrayListDefault)); Uri uri = new Uri(url); string trimmedUrl = uri.Query.TrimStart('?'); string[] pairs = trimmedUrl.Split('&'); foreach (string pair in pairs) { string[] splitPairs = pair.Split('='); if (splitPairs.Length == 2) ((ArrayList)queryParams[splitPairs[0]]).Add(splitPairs[1]); } return queryParams; }