Avatar of adworldmedia
adworldmediaFlag for United States of America

asked on 

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.
C#ASP.NET

Avatar of undefined
Last Comment
Navneet Hegde
ASKER CERTIFIED SOLUTION
Avatar of Dave Baldwin
Dave Baldwin
Flag of United States of America image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Hello,

page.requesturl.LastIndesof("/")
Avatar of Navneet Hegde
Navneet Hegde
Flag of United States of America image

HI!

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

Thanks!
ASP.NET
ASP.NET

The successor to Active Server Pages, ASP.NET websites utilize the .NET framework to produce dynamic, data and content-driven web applications and services. ASP.NET code can be written using any .NET supported language. As of 2009, ASP.NET can also apply the Model-View-Controller (MVC) pattern to web applications

128K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo