[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 171
  • Last Modified:

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 ???
0
Vivek Thangaswamy
Asked:
Vivek Thangaswamy
1 Solution
 
BinuthCommented:
           Uri uriO = new Uri(@"http://india:31013/grt/Lists.aspx");
            string sName = uriO.AbsoluteUri.Replace(uriO.PathAndQuery , string.Empty);
0

Featured Post

Prep for the ITIL® Foundation Certification Exam

December’s Course of the Month is now available! Enroll to learn ITIL® Foundation best practices for delivering IT services effectively and efficiently.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now