Skip to content

paonath/PH.WebPathTranslator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

PH.WebPathTranslator NuGet Badge

A tiny c# utility for Translate a web-relative path to a filesystem path (useful in scope where there is not a web server, for example inside services). The code is written in .NET C#.

The package is available on nuget

Feature

  • Translate a Web-Relative path to FileSystem-Path:

    string ToFileSystemPath(string webrelativePath);
  • Translate a FileInfo full path to web-relative:

    string ToWebRelativePath(FileInfo file);
  • Translate a DirectoryInfo full path to web-relative

    string ToWebRelativePath(DirectoryInfo directory);
  • Return a FileInfo from its web-relative position:

    FileInfo GetFile(string webrelativePath);
  • Return a DirectoryInfo from its web-relative position:

    DirectoryInfo GetDirectory(string webrelativePath);

Example

Translate web-path to filesystem path

IWebPathTranslator svc = new WebPathTranslator(@"c:\temp");
var result = svc.ToFileSystemPath("~/Folder1/Folder2");
//result is 'c:\temp\Folder1\Folder2'

About

Translate a web-relative path to a filesystem path

Resources

License

Stars

Watchers

Forks

Packages

No packages published