//public static string GetSubdomain(this HttpRequestBase request) //{ // return request.Url.Host.ToLower().Replace(".ogat.space", ""); //} ///Get the sub-domain from the provided URL /// <summary> /// <param name="url">URL to retrieve sub-domain from</param> /// <returns></returns> /// <remarks>http://developmentsolutionsjunction.blogspot.com/2011/05/get-sub-domain-from-provided-url.html</remarks> /// </summary> public static string RetrieveSubDomain(this Uri url) { string subDomain = ""; if (url.HostNameType == UriHostNameType.Dns && (!(url.HostNameType == UriHostNameType.Unknown))) { string host = url.Host; if (host.StartsWith("www.")) { host = host.Remove(0, 4); } int length = host.Split('.').Length; if (length > 2) { int last = host.LastIndexOf("."); int idx = host.LastIndexOf(".", last - 1); subDomain = host.Substring(0, idx); } } return(MiscUtility.isDebug() ? "localhost" : subDomain); }
public static bool isValidSubdomain(this string subDomain) { //return (subDomain != "localhost" && subDomain != "www" && subDomain != ""); return(MiscUtility.isDebug() ? true : (subDomain != "localhost" && subDomain != "www" && subDomain != "")); }
/// <summary> /// Return string with Version number - then build date /// </summary> /// <returns></returns> public static string GetVersionString() { string version = Assembly.GetExecutingAssembly().GetName().Version.ToString(); return(version + " - " + MiscUtility.getBuildDate().ToString("MM/dd/yyyy - HH:mm")); }