String URL need to be extracted

I have string value like this

example:
http://india:31013/_vti_bin/Lists.asmx
http://india:31013/grt/Lists.aspx
http://india:31013/grt/gd.html   ...

I need to get this part alone http://india:31013/ as a result... how to do it in C#? any RegEx or ???
LVL 11
Vivek ThangaswamyAsked:
Who is Participating?
 
BinuthConnect With a Mentor Commented:
           Uri uriO = new Uri(@"http://india:31013/grt/Lists.aspx");
            string sName = uriO.AbsoluteUri.Replace(uriO.PathAndQuery , string.Empty);
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.