상대 경로를 입력 한 다음 현재 URL을 기반으로 전체 경로를 반환하는 함수를 작성할 수 있습니다. 방법에있는 것과 같이 ~을 통과하지 마십시오
URL used for this example:
http://localhost:12345/site/page.aspx?q1=1&q2=2
Value of HttpContext.Current.Request.Url.Host
localhost
Value of HttpContext.Current.Request.Url.Authority
localhost:12345
Value of HttpContext.Current.Request.Url.AbsolutePath
/site/page.aspx
Value of HttpContext.Current.Request.ApplicationPath
/site
Value of HttpContext.Current.Request.Url.AbsoluteUri
http://localhost:12345/site/page.aspx?q1=1&q2=2
static string (HttpContext context , string rel)
{
return HttpContext.Current.Request.Url.Scheme + "://" HttpContext.Current.Request.Url.Authority + rel;
}
개봉 해 주셔서 감사합니다. 왜 패스해야합니까 ~ – lordkain
~ 필요한 URL의 일부가 아닙니다. – Devesh