2008. 11. 7. 22:24
현재 도메인을 찾을하고 하다가 찾은거...될랑가..아직 한해봤는데..ㅋㅋㅋㅋㅋ
-
///Get the sub-domain from the provided URL
-
/// </summary>
-
/// <param name="url">URL to retrieve sub-domain from</param>
-
/// <returns></returns>
-
public static string RetrieveSubDomain(Uri url)
-
{
-
string subDomain = "";
-
if (url.HostNameType == UriHostNameType.Dns && (!(url.HostNameType == UriHostNameType.Unknown)))
-
{
-
string host = url.Host;
-
int length = host.Split('.').Length;
-
if (length > 2)
-
{
-
int last = host.LastIndexOf(".");
-
int idx = host.LastIndexOf(".", last - 1);
-
subDomain = host.Substring(0, idx);
-
}
-
}
-
-
return subDomain;
-
}
///Get the sub-domain from the provided URL
/// </summary>
/// <param name="url">URL to retrieve sub-domain from</param>
/// <returns></returns>
public static string RetrieveSubDomain(Uri url)
{
string subDomain = "";
if (url.HostNameType == UriHostNameType.Dns && (!(url.HostNameType == UriHostNameType.Unknown)))
{
string host = url.Host;
int length = host.Split('.').Length;
if (length > 2)
{
int last = host.LastIndexOf(".");
int idx = host.LastIndexOf(".", last - 1);
subDomain = host.Substring(0, idx);
}
}
return subDomain;
}