November Happy Hour will be moved to Thursday December 5th.

Class StaticFileHandler

Static file handler for Virtual Path Providers

Inheritance
System.Object
StaticFileHandler
Implements
System.Web.IHttpHandler
Namespace: EPiServer.Web
Assembly: EPiServer.Framework.AspNet.dll
Version: 11.20.7
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
[Obsolete("Use alternative constructor")]
public StaticFileHandler(IHostingEnvironment hostingEnvironment)
Parameters
Type Name Description
IHostingEnvironment hostingEnvironment

The hosting environment.

StaticFileHandler(IHostingEnvironment, IMimeTypeResolver)

Initializes a new instance of the StaticFileHandler class.

Declaration
public StaticFileHandler(IHostingEnvironment hostingEnvironment, IMimeTypeResolver mimeTypeResolver)
Parameters
Type Name Description
IHostingEnvironment hostingEnvironment
IMimeTypeResolver mimeTypeResolver

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

Extension Methods