String URL need to be extracted

Posted on 2008-11-05
Last Modified: 2012-05-05
I have string value like this

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 ???
Question by:Vivek Thangaswamy
    1 Comment
    LVL 14

    Accepted Solution

               Uri uriO = new Uri(@"http://india:31013/grt/Lists.aspx");
                string sName = uriO.AbsoluteUri.Replace(uriO.PathAndQuery , string.Empty);

    Featured Post

    Why You Should Analyze Threat Actor TTPs

    After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

    Join & Write a Comment

    This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
    A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
    how to add IIS SMTP to handle application/Scanner relays into office 365.
    Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

    734 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    17 Experts available now in Live!

    Get 1:1 Help Now