/* * Returns an embedded parameter in the query string that * is introduced by a string specified here as param. * * Further the embedded parameter must be contained in a * pair of matching bounding characters such as: * * " ' | * * The bounding character may not appear in the embedded * parameter. * * The bounding character is determined as the first * character that occurs after param. * * The embedded parameter is the substring between that * first character and its next occurence in the query * string. * * * For example, if the full url is: * * http://www.abc.com/seek.htm?url="http://www.xyz.com?a=1&b=2" * * then the call: * * RequestTools.EmbeddedQueryParam(request, "url=") * * returns: * * http://www.xyz.com?a=1&b=2 * * * This method uses StringTools.FindParameter. * * * Note that this method works in situations where the * simple application of the method QueryParts will fail. */ public static string EmbeddedQueryParam (HttpRequest request, string param) { string query = Query(request); return(StringTools.FindParameter(query, param, false)); }
/* * Returns an embedded parameter with introduction string * param if one exists within the query string of the * given url. * * The conventions of * * StringTools.FindParameter * * should be followed. */ public static string GetEmbeddedParameter (string url, string param, bool unescape) { if (StringTools.IsTrivial(url) || StringTools.IsTrivial(param)) { return(""); } int qmark = url.IndexOf('?'); if (qmark < 0) { return(""); } string query = url.Substring(qmark + 1); if (query.Length == 0) { return(""); } return(StringTools.FindParameter(query, param, unescape)); }