I’ve been searching here on SO but I can’t seem to find the answer to this question. I’m having a heck of a time figuring out if there’s a method that will give me just the main domain from the HttpContext.Current.Request.Url?
Examples:
http://www.example.com > example.com
http://test.example.com > example.com
http://example.com > example.com
Thanks in advance.
Edit
just to clarify a bit. This is for use on my own domains only and not going to be used on every domain in existence.
There’s currently three suffixes that I need to be able to deal with.
- .com
- .ca
- .local
1 Answer