• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 381
  • Last Modified:

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.
0
adworldmedia
Asked:
adworldmedia
1 Solution
 
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
 
NavneetCommented:
HI!

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

Thanks!
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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