本文整理汇总了C#中System.Uri.CompareSchemeAndHost方法的典型用法代码示例。如果您正苦于以下问题:C# Uri.CompareSchemeAndHost方法的具体用法?C# Uri.CompareSchemeAndHost怎么用?C# Uri.CompareSchemeAndHost使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Uri
的用法示例。
在下文中一共展示了Uri.CompareSchemeAndHost方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: NormalAbsoluteUriHostAndSchemeTest
public void NormalAbsoluteUriHostAndSchemeTest()
{
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.CompareSchemeAndHost(uri2));
}
示例2: DefaultPortNotEqualAbsoluteTest
public void DefaultPortNotEqualAbsoluteTest()
{
Uri uri1 = new Uri("http://www.baidu.com/test", UriKind.RelativeOrAbsolute);
Uri uri2 = new Uri("http://www.baidu.com:81/test", UriKind.RelativeOrAbsolute);
Assert.IsFalse(uri1.CompareSchemeAndHost(uri2));
}
示例3: 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;
}
示例4: OneUriIsNullNotEqualTest
public void OneUriIsNullNotEqualTest()
{
Uri uri1 = new Uri("http://www.baidu.com/test", UriKind.RelativeOrAbsolute);
Uri uri2 = null;
Assert.IsFalse(uri1.CompareSchemeAndHost(uri2));
}
示例5: AllRelativeEqualHostAndSchemeTest
public void AllRelativeEqualHostAndSchemeTest()
{
Uri uri1 = new Uri("/test", UriKind.RelativeOrAbsolute);
Uri uri2 = new Uri("/test1", UriKind.RelativeOrAbsolute);
Assert.IsTrue(uri1.CompareSchemeAndHost(uri2));
}