프로그래밍 강의/C#

[콩쌤] C# 현재 페이지 url 가져오기

PineBean 2018. 8. 23. 13:46
1
2
3
4
string AbsoluteUri = HttpContext.Current.Request.Url.AbsoluteUri;
string AbsolutePath = HttpContext.Current.Request.Url.AbsolutePath;
string Host = HttpContext.Current.Request.Url.Host;
 
cs


현재 페이지가 http://localhost/Home/Index 라고 가정했을때의 결과물


AbsoluteUri  = "http://localhost/Home/Index";

AbsolutePath  = "/Home/Index";

Host  = "http://liafreven.tistory.com/16";