chromelyapps / Chromely

Build Cross Platform HTML Desktop Apps on .NET using native GUI, HTML5, JavaScript, CSS, Owin, AspNetCore (MVC, RazorPages, Blazor)
MIT License
2.99k stars 279 forks source link

Howto: Map host to folder for resource files #357

Closed mattkol closed 2 years ago

mattkol commented 2 years ago

The following sample shows how to map host to a folder on the local machine. Like mapping a "http://img" to ""C:\img".

So a file:

C:\\img\image.png

Can be mapped to:

http://img/image.png

v5.2 and above

Requirement: Register the scheme

  UrlSchemes.Add(new UrlScheme(DefaultSchemeName.FOLDERRESOURCE, "http", "img", "E:\img", string.Empty, UrlSchemeType.FolderResource));

v5.1.3

Requirement: Register the scheme

  UrlSchemes.Add(new UrlScheme(DefaultSchemeName.RESOURCE, "http", "img", "C:\\img", string.Empty, UrlSchemeType.Resource));

v5.1.2 and lower

Please see - https://github.com/chromelyapps/Chromely/issues/244#issuecomment-877643819