/// <summary> /// Gets the value of specified parameter from the request Uri. /// </summary> /// <param name="context">HttpContext containing the request uri.</param> /// <param name="baseUri">Base Uri for the specified request.</param> /// <param name="parameterName"><typeref name="AtomPubParameterType"/> name of the parameter whose value is to be retrieved.</param> /// <returns>String containing value for the specified parameter.</returns> internal static string GetValueOfParameterFromUri(HttpContext context, Uri baseUri, AtomPubParameterType parameterName) { UriTemplateMatch matchResult = AtomPubHelper.GetTemplateMatchFromUri(baseUri, context.Request.Url); if (null == matchResult) { return(string.Empty); } string paramName = parameterName.ToString(); string paramValue = string.Empty; foreach (string paramKey in matchResult.BoundVariables.Keys) { if (paramKey.Equals(paramName, StringComparison.OrdinalIgnoreCase)) { paramValue = matchResult.BoundVariables[paramKey]; break; } } return(paramValue); }