/// <summary>Initializes a new instance of the <see cref="T:System.Security.Policy.Site" /> class with the Web site from which a code assembly originates.</summary> /// <param name="name">The Web site of origin for the associated code assembly. </param> /// <exception cref="T:System.ArgumentNullException">The <paramref name="name" /> parameter is null. </exception> public Site(string name) { if (name == null) { throw new ArgumentNullException("url"); } if (!Site.IsValid(name)) { throw new ArgumentException(Locale.GetText("name is not valid")); } this.origin_site = name; }
internal static string UrlToSite(string url) { if (url == null) { return(null); } Uri uri = new Uri(url); if (uri.Scheme == Uri.UriSchemeFile) { return(null); } string host = uri.Host; return((!Site.IsValid(host)) ? null : host); }