本文整理汇总了C#中System.Uri.ComparePathAndParameters方法的典型用法代码示例。如果您正苦于以下问题:C# Uri.ComparePathAndParameters方法的具体用法?C# Uri.ComparePathAndParameters怎么用?C# Uri.ComparePathAndParameters使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Uri
的用法示例。
在下文中一共展示了Uri.ComparePathAndParameters方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UrlIsValid
/// <summary>
/// 目标Url是否合法
/// </summary>
/// <param name="destUrl"></param>
/// <param name="urlCheckParts">需要检查的url中的部分</param>
/// <returns></returns>
public bool UrlIsValid(Uri destUrl, AccessTicketUrlCheckParts urlCheckParts)
{
bool result = true;
if (this.DestinationUrl.IsNotEmpty())
{
Uri uri1 = new Uri(this.DestinationUrl, UriKind.RelativeOrAbsolute);
if ((urlCheckParts & AccessTicketUrlCheckParts.SchemeHostAndPort) != AccessTicketUrlCheckParts.None)
result = uri1.CompareSchemeAndHost(destUrl);
if (result && (urlCheckParts & AccessTicketUrlCheckParts.PathAndParameters) != AccessTicketUrlCheckParts.None)
result = uri1.ComparePathAndParameters(destUrl, AccessTicket.AccessTicketParamName);
}
return result;
}
示例2: NormalPathWithIgnoreParametersEqualTest
public void NormalPathWithIgnoreParametersEqualTest()
{
Uri uri1 = new Uri("http://www.baidu.com/test?name=S1&gender=male", UriKind.RelativeOrAbsolute);
Uri uri2 = new Uri("http://www.baidu.com/test?Name=S1", UriKind.RelativeOrAbsolute);
Assert.IsTrue(uri1.ComparePathAndParameters(uri2, "Gender"));
}
示例3: OneIsRelativePathNotEqualTest
public void OneIsRelativePathNotEqualTest()
{
Uri uri1 = new Uri("http://www.baidu.com/test", UriKind.RelativeOrAbsolute);
Uri uri2 = new Uri("/test1", UriKind.RelativeOrAbsolute);
Assert.IsFalse(uri1.ComparePathAndParameters(uri2));
}
示例4: OneIsRelativePathAndAbsUriPathIsSlashEqualTest
public void OneIsRelativePathAndAbsUriPathIsSlashEqualTest()
{
Uri uri1 = new Uri("http://www.baidu.com/", UriKind.RelativeOrAbsolute);
Uri uri2 = new Uri("/", UriKind.RelativeOrAbsolute);
Assert.IsTrue(uri1.ComparePathAndParameters(uri2));
}
示例5: RelativePathEqualTest
public void RelativePathEqualTest()
{
Uri uri1 = new Uri("/test", UriKind.RelativeOrAbsolute);
Uri uri2 = new Uri("/test", UriKind.RelativeOrAbsolute);
Assert.IsTrue(uri1.ComparePathAndParameters(uri2));
}
示例6: NormalPathEqualTest
public void NormalPathEqualTest()
{
Uri uri1 = new Uri("http://www.baidu.com/test", UriKind.RelativeOrAbsolute);
Uri uri2 = new Uri("http://www.baidu.com/test", UriKind.RelativeOrAbsolute);
Assert.IsTrue(uri1.ComparePathAndParameters(uri2));
}