How to get the URL of a local FILE

Posted on 2011-10-05
Last Modified: 2012-05-12
I'm retrieving programatically a list of files within a folder that is within an IIS web domain site.

I want to convert each file (ie: c:\inetpub\wwwroot\images\test.jpg) into a URL, ie:

I can't seem to figure out how to do this...  Would need to be C# code

Any help would be appreciated.
Question by:adworldmedia
    LVL 82

    Accepted Solution

    Do a string replace of "c:\inetpub\wwwroot" with "" and change all "\" to "/".
    LVL 11

    Expert Comment


    LVL 15

    Expert Comment


    try this


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Summary: Persistence is the capability of an application to store the state of objects and recover it when necessary. This article compares the two common types of serialization in aspects of data access, readability, and runtime cost. A ready-to…
    IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
    Need more eyes on your posted question? Go ahead and follow the quick steps in this video to learn how to Request Attention to your question. *Log into your Experts Exchange account *Find the question you want to Request Attention for *Go to the e…
    Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

    761 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

    11 Experts available now in Live!

    Get 1:1 Help Now