src/Foundation/Net/Gimela.Net.Http/Resources/FileResources.cs
/// <summary>
/// Add a new resource mapping.
/// </summary>
/// <param name="uri">Request URI path</param>
/// <param name="absolutePath">Disk path</param>
/// <remarks>
/// File names should not be included in URI or path.
/// </remarks>
/// <example>
/// <code>
/// resources.Add("/files/", "C:\\intetpub\\files\\");
/// </code>
/// </example>
/// <exception cref="DirectoryNotFoundException"><c>absolutePath</c> is not found.</exception>
Add a new resource mapping.
Add a new resource mapping .
public void Add(string uri, string absolutePath)
    {
      if (!absolutePath.EndsWith(PathSeparator))
        absolutePath += PathSeparator;
      if (!Directory.Exists(absolutePath))
        throw new DirectoryNotFoundException(absolutePath);
      if (!uri.EndsWith("/"))
        uri += "/";
      string relativePath = uri.Replace('/', Path.PathSeparator);
      _mappings.Add(new Mapping { AbsolutePath = absolutePath, UriPath = uri, RelativePath = relativePath });
    }
public void Add ( string uri , string absolutePath ) { if ( ! absolutePath . EndsWith ( PathSeparator ) ) absolutePath += PathSeparator ; if ( ! Directory . Exists ( absolutePath ) ) throw new DirectoryNotFoundException ( absolutePath ) ; if ( ! uri . EndsWith ( " " ) ) uri += " " ; string relativePath = uri . Replace ( ' ' , Path . PathSeparator ) ; _mappings . Add ( new Mapping { AbsolutePath = absolutePath , UriPath = uri , RelativePath = relativePath } ) ; }
Add a new resource mapping.
Add a new resource mapping .
None
uri
string
Request URI path
Request URI path
absolutePath
string
None
remarks
File names should not be included in URI or path.
File names should not be included in URI or path .
example
None