I am currently working on a project with .NET 1.1 framework and I am stuck at this point. I have a string like \"http://www.example.com/mypage/default.aspx\" or it might be \"ht
Short Answer
myUri.GetLeftPart(System.UriPartial.Authority)
Long Answer
Assuming "Base URI" means something like http://www.example.com
, you can get the base uri like this:
var myUri= new Uri("http://www.example.com/mypage/default.aspx");
var baseUri = myUri.GetLeftPart(System.UriPartial.Authority)
This gives: http://www.example.com
Note: uri.Host
gives: www.example.com
(not including port or scheme)