0

I want to get root url?

@Request.Url.AbsoluteUri

This is example if i have somthing like this

http://www.example.com/contact if I am on page contact page I want to get this like http://www.example.com is this possible?

Schneider
  • 2,446
  • 6
  • 28
  • 38
  • Duplicate of http://stackoverflow.com/questions/61817/whats-the-best-method-in-asp-net-to-obtain-the-current-domain – L-Four Apr 02 '14 at 09:22

2 Answers2

1
var baseUrl = Request.Url.GetLeftPart(UriPartial.Authority);
Raja Nadar
  • 9,409
  • 2
  • 32
  • 41
0

To get base URl use

Request.Url.Authority 
Morten Anderson
  • 2,301
  • 15
  • 20