Visual Studio/ASP.NET

Get url in asp.net

철냄비짱 2014. 2. 21. 09:16

Get url in asp.net

string url = HttpContext.Current.Request.Url.AbsoluteUri;
// http://localhost:1302/TESTERS/Default6.aspx

string path = HttpContext.Current.Request.Url.AbsolutePath;
// /TESTERS/Default6.aspx

string host = HttpContext.Current.Request.Url.Host;
// localhost

string url = Request.Url.Host;