public void GetParameterFromMissingValue() { string parameter1 = "Parameter1"; string parameter2 = "Parameter2"; string value1 = "Value1ä#"; string url = string.Format( "http://localhost/Default.html?{0}={1}", parameter1, HttpUtility.UrlEncode(value1, _currentEncoding)); string actual = UrlUtility.GetParameter(url, parameter2, _currentEncoding); Assert.That(actual, Is.Null); }
public void GetParameterFromEmptyValue() { string parameter1 = "Parameter1"; string parameter2 = "Parameter2"; string value1 = "Value1ä#"; string value2 = string.Empty; string url = string.Format( "http://localhost/Default.html?{0}={1}&{2}=", parameter1, HttpUtility.UrlEncode(value1, _currentEncoding), parameter2); string actual = UrlUtility.GetParameter(url, parameter2, _currentEncoding); Assert.That(actual, Is.EqualTo(value2)); }
private StringCollection ExtractReturnUrls(string url) { StringCollection returnUrls = new StringCollection(); while (!string.IsNullOrEmpty(url)) { string currentUrl = url; url = UrlUtility.GetParameter(currentUrl, WxeHandler.Parameters.ReturnUrl, _httpContext.Request.ContentEncoding); if (!string.IsNullOrEmpty(url)) { currentUrl = UrlUtility.DeleteParameter(currentUrl, WxeHandler.Parameters.ReturnUrl); } returnUrls.Add(currentUrl); } return(returnUrls); }