검색결과 리스트
baseurl에 해당되는 글 1건
- 2021.12.23 BaseURL 가져오기
글
.Net4.0 c#
public static string GetBaseUrl()
{
string protocol;
if (HttpContext.Current.Request.IsSecureConnection)
protocol = "https";
else
protocol = "http";
System.Text.StringBuilder uri = new System.Text.StringBuilder(protocol + "://");
string hostname = HttpContext.Current.Request.Url.Host;
uri.Append(hostname);
int port = HttpContext.Current.Request.Url.Port;
if (port != 80 && port != 443)
{
uri.Append(":");
uri.Append(port.ToString());
}
return uri.ToString();
}
RECENT COMMENT