test whether a path is in public web directory?

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



Are there any specialized methods for determining whether a path or UNC points to a location within a site's web directories? Are there any methods for turning an absolute path into a relative URL?

My app has UNCs stored in a database and needs to serve the files that the UNC points to. If the UNC is within the site, I just need to return a relative path. If it isn't, I need to copy the file to a public cache and return a relative path to the cached file.


.