Class StaticFileHandler

Static file handler for Virtual Path Providers

Inheritance
System.Object
StaticFileHandler
Implements
System.Web.IHttpHandler
Namespace: EPiServer.Web
Assembly: EPiServer.Framework.dll
Version: 8.11.0
Syntax
public class StaticFileHandler : MediaHandlerBase, IHttpHandler

Constructors

StaticFileHandler()

Initializes a new instance of the StaticFileHandler class.

Declaration
public StaticFileHandler()

StaticFileHandler(IHostingEnvironment)

Initializes a new instance of the StaticFileHandler class.

Declaration
public StaticFileHandler(IHostingEnvironment hostingEnvironment)
Parameters
Type Name Description
IHostingEnvironment hostingEnvironment

The hosting environment.

Methods

OnFileProcessing(VirtualPathEventArgs)

Raises the FileProcessing event.

Declaration
protected virtual void OnFileProcessing(VirtualPathEventArgs args)
Parameters
Type Name Description
VirtualPathEventArgs args

The VirtualPathEventArgs instance containing the event data.

OnFileTransmitting(VirtualPathEventArgs)

Raises the FileTransmitting event.

Declaration
protected virtual void OnFileTransmitting(VirtualPathEventArgs args)
Parameters
Type Name Description
VirtualPathEventArgs args

The VirtualPathEventArgs instance containing the event data.

ProcessRequestInternal(HttpContextBase)

The reason for keeping the actual "work code" in a separate 'ProcessRequestInternal' function was that it could possibly be called from both IHttpHandler.ProcessRequest as well as from IHttpAsyncHandler.BeginProcessRequest()

Declaration
protected override bool ProcessRequestInternal(HttpContextBase context)
Parameters
Type Name Description
System.Web.HttpContextBase context
Returns
Type Description
System.Boolean

True if request was handled, otherwise false

Overrides

Events

FileProcessing

Occurs when file processing begins and allows for changing the transmitted file.

Declaration
public static event EventHandler<VirtualPathEventArgs> FileProcessing
Event Type
Type Description
System.EventHandler<VirtualPathEventArgs>
Remarks

The transmitted file can be changed by setting VirtualItem to an existing file.

FileTransmitting

Occurs when file is being transmitted by handler, allows to cancel transmitting.

Declaration
public static event EventHandler<VirtualPathEventArgs> FileTransmitting
Event Type
Type Description
System.EventHandler<VirtualPathEventArgs>
Remarks

Only cancellation of the transmission using Cancel is possible when this event is raised. Changes to the VirtualItem is ignored.

Implements

System.Web.IHttpHandler