private static Boolean IsFirstDomainEqual(String url1, String url2) { String host1 = new UriBuilder(url1).Host; String host2 = new UriBuilder(url2).Host; return(host1.Equals(host2)); }
/// <summary> /// 是否是外部链接 /// </summary> /// <param name="url"></param> /// <returns></returns> public static Boolean IsOutUrl(String url) { Boolean isFull = IsFullUrl(url); if (!isFull) { return(false); } String targetHost = new UriBuilder(url).Host; if (targetHost.Equals(SystemInfo.HostNoSubdomain)) { return(false); } if (targetHost.IndexOf(SystemInfo.HostNoSubdomain) >= 0) { return(false); } return(true); }
private static Boolean IsHostSame( String url1, String url2 ) { String host1 = new UriBuilder( url1 ).Host; String host2 = new UriBuilder( url2 ).Host; return host1.Equals( host2 ); }
/// <summary> /// �Ƿ����ⲿ���� /// </summary> /// <param name="url"></param> /// <returns></returns> public static Boolean IsOutUrl( String url ) { Boolean isFull = IsFullUrl( url ); if (!isFull) return false; String targetHost = new UriBuilder( url ).Host; if (targetHost.Equals( SystemInfo.HostNoSubdomain )) return false; if (targetHost.IndexOf( SystemInfo.HostNoSubdomain ) >= 0) return false; return true; }
/// <summary> /// �Ƿ����ⲿ���� /// </summary> /// <param name="url"></param> /// <returns></returns> public static Boolean IsOutUrl( String url ) { Boolean isFull = IsFullUrl( url ); if (!isFull) return false; String targetHost = new UriBuilder( url ).Host; return !targetHost.Equals( SystemInfo.Host ); }
public void Equals () { b = new UriBuilder ("http://", "www.ximian.com", 80, "foo/bar/index.html?item=1"); Assert.AreEqual ("foo/bar/index.html%3Fitem=1", b.Path, "1.Path"); Assert.AreEqual ("http://www.ximian.com:80/foo/bar/index.html%3Fitem=1", b.ToString (), "1.ToString"); b2 = new UriBuilder ("http", "www.ximian.com", 80, "/foo/bar/index.html", "?item=1"); Assert.AreEqual ("http://www.ximian.com:80/foo/bar/index.html?item=1", b2.ToString (), "2.ToString"); b3 = new UriBuilder (new Uri ("http://www.ximian.com/foo/bar/index.html?item=1")); Assert.AreEqual ("http://www.ximian.com:80/foo/bar/index.html?item=1", b3.ToString (), "3.ToString"); Assert.IsFalse (b.Equals (b2), "#1"); Assert.IsFalse (b.Uri.Equals (b2.Uri), "#2"); Assert.IsFalse (b.Equals (b3), "#3"); Assert.IsFalse (b3.Equals (b), "#4"); Assert.IsTrue (b2.Equals (b3), "#5"); }
public void Equals () { b = new UriBuilder ("http://", "www.ximian.com", 80, "foo/bar/index.html?item=1"); b2 = new UriBuilder ("http", "www.ximian.com", 80, "/foo/bar/index.html", "?item=1"); b3 = new UriBuilder (new Uri ("http://www.ximian.com/foo/bar/index.html?item=1")); Assert ("#1", b.Equals (b2)); Assert ("#2", b.Uri.Equals (b2.Uri)); Assert ("#3", b.Equals (b3)); Assert ("#4", b2.Equals (b3)); Assert ("#5", b3.Equals (b)); }