2013. 6. 18. 14:40
Well if you are doing this in Asp.Net or have access to HttpContext.Current.Request I'd say these are easier and more general ways of getting them:
var scheme = Request.Url.Scheme; // will get http, https, etc.
var host = Request.Url.Host; // will get www.mywebsite.com
var port = Request.Url.Port; // will get the port
var path = Request.Url.AbsolutePath; // should get the /pages/page1.aspx part, can't remember if it only get pages/page1.aspx
I hope this helps. :)
http://stackoverflow.com/questions/21640/net-get-protocol-host-and-port
'.NET > .NET' 카테고리의 다른 글
[Entity Framework] Dataset Template (0) | 2013.08.22 |
---|---|
[Entity Framework] Linq2SQL (0) | 2013.08.22 |
[.NET MVC] 컨트롤러에서 파일 리턴 전송 (0) | 2013.06.17 |
[.NET MVC] Html.DropDownListFor() 드롭다운리스트 (0) | 2013.06.17 |
[ASP.NET] C# 웹페이지 PDF 변환 인쇄 (0) | 2013.06.12 |