PH.WebPathTranslator 1.0.2

Install-Package PH.WebPathTranslator -Version 1.0.2
dotnet add package PH.WebPathTranslator --version 1.0.2
<PackageReference Include="PH.WebPathTranslator" Version="1.0.2" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add PH.WebPathTranslator --version 1.0.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: PH.WebPathTranslator, 1.0.2"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install PH.WebPathTranslator as a Cake Addin
#addin nuget:?package=PH.WebPathTranslator&version=1.0.2

// Install PH.WebPathTranslator as a Cake Tool
#tool nuget:?package=PH.WebPathTranslator&version=1.0.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

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'

NuGet packages (1)

Showing the top 1 NuGet packages that depend on PH.WebPathTranslator:

Package Downloads
PH.Core3.AspNetCoreApi

NetCoreApp3.0 astraction - API Base Package: should be referenced by Asp.Net Core API Project

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.2 200 9/16/2020
1.0.1 1,081 8/28/2019
1.0.0 334 2/5/2019