What's the best method in ASP.NET to obtain the current domain?
Posted
by Graphain
on Stack Overflow
See other posts from Stack Overflow
or by Graphain
Published on 2008-09-15T03:04:09Z
Indexed on
2010/05/20
22:40 UTC
Read the original article
Hit count: 300
Hi,
I am wondering what the best way to obtain the current domain is in ASP.NET?
For instance:
http://www.domainname.com/subdir/ should yield http://www.domainname.com http://www.sub.domainname.com/subdir/ should yield http://sub.domainname.com
As a guide, I should be able to add a url like "/Folder/Content/filename.html" (say as generated by Url.RouteUrl() in ASP.NET MVC) straight onto the URL and it should work.
© Stack Overflow or respective owner