Class FileModuleExtensions
Provides extension methods for FileModule and derived classes.
Inherited Members
Namespace: EmbedIO.Files
Syntax
public static class FileModuleExtensions
Methods
HandleDirectoryNotListable<TModule>(TModule, FileRequestHandlerCallback)
Sets a FileRequestHandlerCallback that is called by a module whenever the requested URL path has been mapped to a directory, but directory listing has been disabled.
Declaration
public static TModule HandleDirectoryNotListable<TModule>(this TModule this, FileRequestHandlerCallback callback)
where TModule : FileModule
Parameters
Type | Name | Description |
---|---|---|
TModule | this | The module on which this method is called. |
FileRequestHandlerCallback | callback | The method to call. |
Returns
Type | Description |
---|---|
TModule |
|
Type Parameters
Name | Description |
---|---|
TModule | The type of the module on which this method is called. |
See Also
HandleMappingFailed<TModule>(TModule, FileRequestHandlerCallback)
Sets a FileRequestHandlerCallback that is called by a module whenever the requested URL path could not be mapped to any file or directory.
Declaration
public static TModule HandleMappingFailed<TModule>(this TModule this, FileRequestHandlerCallback callback)
where TModule : FileModule
Parameters
Type | Name | Description |
---|---|---|
TModule | this | The module on which this method is called. |
FileRequestHandlerCallback | callback | The method to call. |
Returns
Type | Description |
---|---|
TModule |
|
Type Parameters
Name | Description |
---|---|
TModule | The type of the module on which this method is called. |
See Also
HandleMethodNotAllowed<TModule>(TModule, FileRequestHandlerCallback)
Sets a FileRequestHandlerCallback that is called by a module whenever
the requested URL path has been mapped to a file or directory, but the request's
HTTP method is neither GET
nor HEAD
.
Declaration
public static TModule HandleMethodNotAllowed<TModule>(this TModule this, FileRequestHandlerCallback callback)
where TModule : FileModule
Parameters
Type | Name | Description |
---|---|---|
TModule | this | The module on which this method is called. |
FileRequestHandlerCallback | callback | The method to call. |
Returns
Type | Description |
---|---|
TModule |
|
Type Parameters
Name | Description |
---|---|
TModule | The type of the module on which this method is called. |
See Also
WithCache<TModule>(TModule, FileCache)
Sets the FileCache used by a module to store hashes and, optionally, file contents and rendered directory listings.
Declaration
public static TModule WithCache<TModule>(this TModule this, FileCache value)
where TModule : FileModule
Parameters
Type | Name | Description |
---|---|---|
TModule | this | The module on which this method is called. |
FileCache | value | An instance of FileCache. |
Returns
Type | Description |
---|---|
TModule |
|
Type Parameters
Name | Description |
---|---|
TModule | The type of the module on which this method is called. |
See Also
WithContentCaching<TModule>(TModule)
Enables caching of file contents and directory listings on a module.
Declaration
public static TModule WithContentCaching<TModule>(this TModule this)
where TModule : FileModule
Parameters
Type | Name | Description |
---|---|---|
TModule | this | The module on which this method is called. |
Returns
Type | Description |
---|---|
TModule |
|
Type Parameters
Name | Description |
---|---|
TModule | The type of the module on which this method is called. |
See Also
WithContentCaching<TModule>(TModule, Boolean)
Sets a value indicating whether a module caches the contents of files and directory listings.
Declaration
public static TModule WithContentCaching<TModule>(this TModule this, bool value)
where TModule : FileModule
Parameters
Type | Name | Description |
---|---|---|
TModule | this | The module on which this method is called. |
Boolean | value | true to enable caching of contents; false to disable it. |
Returns
Type | Description |
---|---|
TModule |
|
Type Parameters
Name | Description |
---|---|
TModule | The type of the module on which this method is called. |
See Also
WithContentCaching<TModule>(TModule, Int32, Int32)
Enables caching of file contents and directory listings on a module.
Declaration
public static TModule WithContentCaching<TModule>(this TModule this, int maxFileSizeKb, int maxSizeKb)
where TModule : FileModule
Parameters
Type | Name | Description |
---|---|---|
TModule | this | The module on which this method is called. |
Int32 | maxFileSizeKb | true sets the maximum size of a single cached file in kilobytes |
Int32 | maxSizeKb | true sets the maximum total size of cached data in kilobytes |
Returns
Type | Description |
---|---|
TModule |
|
Type Parameters
Name | Description |
---|---|
TModule | The type of the module on which this method is called. |
See Also
WithDefaultDocument<TModule>(TModule, String)
Sets the name of the default document served, if it exists, instead of a directory listing when the path of a requested URL maps to a directory.
Declaration
public static TModule WithDefaultDocument<TModule>(this TModule this, string value)
where TModule : FileModule
Parameters
Type | Name | Description |
---|---|---|
TModule | this | The module on which this method is called. |
String | value | The name of the default document. |
Returns
Type | Description |
---|---|
TModule |
|
Type Parameters
Name | Description |
---|---|
TModule | The type of the module on which this method is called. |
See Also
WithDefaultExtension<TModule>(TModule, String)
Sets the default extension appended to requested URL paths that do not map to any file or directory.
Declaration
public static TModule WithDefaultExtension<TModule>(this TModule this, string value)
where TModule : FileModule
Parameters
Type | Name | Description |
---|---|---|
TModule | this | The module on which this method is called. |
String | value | The default extension. |
Returns
Type | Description |
---|---|
TModule |
|
Type Parameters
Name | Description |
---|---|
TModule | The type of the module on which this method is called. |
See Also
WithDirectoryLister<TModule>(TModule, IDirectoryLister)
Sets the IDirectoryLister interface used to generate directory listing in a module.
Declaration
public static TModule WithDirectoryLister<TModule>(this TModule this, IDirectoryLister value)
where TModule : FileModule
Parameters
Type | Name | Description |
---|---|---|
TModule | this | The module on which this method is called. |
IDirectoryLister | value | An IDirectoryLister interface, or null to disable the generation of directory listings. |
Returns
Type | Description |
---|---|
TModule |
|
Type Parameters
Name | Description |
---|---|
TModule | The type of the module on which this method is called. |
See Also
WithoutContentCaching<TModule>(TModule)
Disables caching of file contents and directory listings on a module.
Declaration
public static TModule WithoutContentCaching<TModule>(this TModule this)
where TModule : FileModule
Parameters
Type | Name | Description |
---|---|---|
TModule | this | The module on which this method is called. |
Returns
Type | Description |
---|---|
TModule |
|
Type Parameters
Name | Description |
---|---|
TModule | The type of the module on which this method is called. |
See Also
WithoutDefaultDocument<TModule>(TModule)
Sets the name of the default document to null.
Declaration
public static TModule WithoutDefaultDocument<TModule>(this TModule this)
where TModule : FileModule
Parameters
Type | Name | Description |
---|---|---|
TModule | this | The module on which this method is called. |
Returns
Type | Description |
---|---|
TModule |
|
Type Parameters
Name | Description |
---|---|
TModule | The type of the module on which this method is called. |
See Also
WithoutDefaultExtension<TModule>(TModule)
Sets the default extension to null.
Declaration
public static TModule WithoutDefaultExtension<TModule>(this TModule this)
where TModule : FileModule
Parameters
Type | Name | Description |
---|---|---|
TModule | this | The module on which this method is called. |
Returns
Type | Description |
---|---|
TModule |
|
Type Parameters
Name | Description |
---|---|
TModule | The type of the module on which this method is called. |
See Also
WithoutDirectoryLister<TModule>(TModule)
Sets a module's DirectoryLister property to null, disabling the generation of directory listings.
Declaration
public static TModule WithoutDirectoryLister<TModule>(this TModule this)
where TModule : FileModule
Parameters
Type | Name | Description |
---|---|---|
TModule | this | The module on which this method is called. |
Returns
Type | Description |
---|---|
TModule |
|
Type Parameters
Name | Description |
---|---|
TModule | The type of the module on which this method is called. |