var uri = new Uri("http://localhost:3617/Main/User"); var noLastSegment = string.Format("{0}://{1}", uri.Scheme, uri.Authority); for(int i = 0; i < uri.Segments.Length - 1; i++) { noLastSegment += uri.Segments[i]; } // Remove the last portion noLastSegment = noLastSegment.Trim("/".ToCharArray()); // This will given you http://localhost:3617/Main
Thanks, A2H My Blog
Login to post response