How to get the URL of a local FILE

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: http://www.mysite.com/images/test.jpg

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

Any help would be appreciated.
adworldmediaCTOAsked:
Who is Participating?
 
Dave BaldwinFixer of ProblemsCommented:
Do a string replace of "c:\inetpub\wwwroot" with "http://www.mysite.com" and change all "\" to "/".
0
 
SAMIR BHOGAYTAFreelancer and IT ConsultantCommented:
Hello,

page.requesturl.LastIndesof("/")
0
 
NavneetSoftware EngineerCommented:
HI!

try this
System.Web.VirtualPathUtility.ToAbsolute("yourRelativePath");

Thanks!
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.