Class MediaHandlerBase
Abstract media handler that can be used for any type of binary streams or files
Implements
Inherited Members
Namespace: EPiServer.Web
Assembly: EPiServer.Framework.AspNet.dll
Version: 11.20.7Syntax
public abstract class MediaHandlerBase : IHttpHandler
Constructors
MediaHandlerBase()
Initializes a new instance of the MediaHandlerBase class.
Declaration
protected MediaHandlerBase()
Properties
IsReusable
Declaration
public bool IsReusable { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Methods
BeginTransmitStream(HttpContextBase, Stream, AsyncCallback, Object)
Async variant of transmitstream that uses from IHttpAsyncHandler.
Declaration
protected virtual IAsyncResult BeginTransmitStream(HttpContextBase context, Stream source, AsyncCallback cb, object extraData)
Parameters
Type | Name | Description |
---|---|---|
System.Web.HttpContextBase | context | |
System.IO.Stream | source | |
System.AsyncCallback | cb | |
System.Object | extraData |
Returns
Type | Description |
---|---|
System.IAsyncResult |
Remarks
This method only supports streams that has Seek capabilities. Use TransmitStream if the stream doesn't support this.
EndTransmitStream(IAsyncResult)
Declaration
protected virtual bool EndTransmitStream(IAsyncResult res)
Parameters
Type | Name | Description |
---|---|---|
System.IAsyncResult | res |
Returns
Type | Description |
---|---|
System.Boolean |
NotModifiedHandling(HttpContextBase, DateTime)
Handles "Not Modified" 304 status notification.
Declaration
protected bool NotModifiedHandling(HttpContextBase context, DateTime modifiedDate)
Parameters
Type | Name | Description |
---|---|---|
System.Web.HttpContextBase | context | The context. |
System.DateTime | modifiedDate | The modified date. |
Returns
Type | Description |
---|---|
System.Boolean | True if the request will return a Not Modified response. |
ProcessRequest(HttpContext)
Processes the request
Declaration
public virtual void ProcessRequest(HttpContext context)
Parameters
Type | Name | Description |
---|---|---|
System.Web.HttpContext | context | The context |
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 abstract bool ProcessRequestInternal(HttpContextBase context)
Parameters
Type | Name | Description |
---|---|---|
System.Web.HttpContextBase | context |
Returns
Type | Description |
---|---|
System.Boolean | True if request was handled, otherwise false |
SetCachePolicy(HttpContextBase, DateTime)
Configures cache policy of a static file based on configuration rules
Declaration
protected virtual void SetCachePolicy(HttpContextBase context, DateTime fileChangedDate)
Parameters
Type | Name | Description |
---|---|---|
System.Web.HttpContextBase | context | The HttpContext for the current request. |
System.DateTime | fileChangedDate | The changed date for the file that is being requested. |
Remarks
Configuration setting expirationTime in web.config states the Expires date that is added to the Resonse (which browsers typically uses to control how long to cache the file before a new request). If TimeSpan.Zero is specified in expirationTime no Expires date is added which most browsers will interpret so they make a request for the file each time but since Last-Modified is added a 304 (Not modified) will be returned by server if file has not changed.
ShouldFlushMediaType(String)
Declaration
protected virtual bool ShouldFlushMediaType(string mediaType)
Parameters
Type | Name | Description |
---|---|---|
System.String | mediaType |
Returns
Type | Description |
---|---|
System.Boolean |
TransmitFile(HttpContextBase, String)
Declaration
protected virtual void TransmitFile(HttpContextBase context, string filePath)
Parameters
Type | Name | Description |
---|---|---|
System.Web.HttpContextBase | context | |
System.String | filePath |
TransmitStream(HttpContextBase, Stream)
Declaration
protected virtual void TransmitStream(HttpContextBase context, Stream source)
Parameters
Type | Name | Description |
---|---|---|
System.Web.HttpContextBase | context | |
System.IO.Stream | source |