Class UrlRewriteModuleBase
Responsible for raising appropriate events for mapping between internal and external formats of the request URLs.
Implements
Inherited Members
Namespace: EPiServer.Web
Assembly: EPiServer.Cms.AspNet.dll
Version: 11.20.7Syntax
public abstract class UrlRewriteModuleBase : IHttpModule
Remarks
Will parse outgoing HTML, and incoming and outgoing special urls and parameter strings, raising the appropriate events implemented by the implementation derived classes. It is this modules responsibility to identify all necessary urls for rewriting in one or the other direction. The descendant class must provide the actual rewriting functionality.
Constructors
UrlRewriteModuleBase()
Declaration
protected UrlRewriteModuleBase()
Properties
FURLRewriteResponse
Gets or sets a value indicating whether the response to the current request should be processed for rewriting of internal links to friendly urls.
Declaration
public virtual bool FURLRewriteResponse { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
UrlExternal
Gets or sets the external URL.
Declaration
public UrlBuilder UrlExternal { get; }
Property Value
Type | Description |
---|---|
UrlBuilder | The external URL |
Remarks
Used together with UrlInternal to provide the necessary context for rewriting relative URL's and to make them relative after rewriting, if required.
UrlInternal
Gets or sets the internal URL.
Declaration
public UrlBuilder UrlInternal { get; }
Property Value
Type | Description |
---|---|
UrlBuilder | The internal URL |
Remarks
Used together with UrlExternal to provide the necessary context for rewriting relative URL's and to make them relative after rewriting, if required.
Methods
Dispose()
Disposes of the resources (other than memory) used by the module that implements System.Web.IHttpModule.
Declaration
public virtual void Dispose()
EndRequestEventHandler(Object, EventArgs)
The EndRequest event handler
Declaration
protected void EndRequestEventHandler(object sender, EventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.Object | sender | |
System.EventArgs | e |
HtmlAddRewriteToExternalFilter(HttpApplication)
Connect a filter for rewriting of outgoing HTML, and perform other actions before actually sending the HTML
Declaration
public abstract void HtmlAddRewriteToExternalFilter(HttpApplication httpApplication)
Parameters
Type | Name | Description |
---|---|---|
System.Web.HttpApplication | httpApplication | The HttpApplication instance |
HttpUrlRewriteToExternal(String, RebaseKind)
Rewrite a request URL to external.
Declaration
protected abstract string HttpUrlRewriteToExternal(string url, RebaseKind typeOfUrl)
Parameters
Type | Name | Description |
---|---|---|
System.String | url | The URL. |
RebaseKind | typeOfUrl | The type of rebasing to perform on the url. |
Returns
Type | Description |
---|---|
System.String | The rewritten request URL |
HttpUrlRewriteToInternal(UrlBuilder)
Rewrite the URL to internal.
Declaration
protected abstract void HttpUrlRewriteToInternal(UrlBuilder url)
Parameters
Type | Name | Description |
---|---|---|
UrlBuilder | url | The URL, possibly rewritten |
Init(HttpApplication)
Called by the ASP.NET framework to initialize module
Declaration
public virtual void Init(HttpApplication application)
Parameters
Type | Name | Description |
---|---|---|
System.Web.HttpApplication | application |
OnHtmlAddedRewriteToExternalFilter(UrlRewriteEventArgs)
Raises the HtmlAddedRewriteToExternalFilter event.
Declaration
protected virtual void OnHtmlAddedRewriteToExternalFilter(UrlRewriteEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
UrlRewriteEventArgs | e | The UrlRewriteEventArgs instance containing the event data. |
OnHtmlAddingRewriteToExternalFilter(UrlRewriteEventArgs)
Raises the HtmlAddingRewriteToExternalFilter event.
Declaration
protected virtual void OnHtmlAddingRewriteToExternalFilter(UrlRewriteEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
UrlRewriteEventArgs | e | The UrlRewriteEventArgs instance containing the event data. |
OnHttpRewriteInit(UrlRewriteEventArgs)
Raises the HttpRewriteInit event.
Declaration
protected virtual void OnHttpRewriteInit(UrlRewriteEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
UrlRewriteEventArgs | e | The UrlRewriteEventArgs instance containing the event data. |
OnHttpRewritingToExternal(UrlRewriteEventArgs)
Raises the HttpRewritingToExternal event.
Declaration
protected virtual void OnHttpRewritingToExternal(UrlRewriteEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
UrlRewriteEventArgs | e | The UrlRewriteEventArgs instance containing the event data. |
OnHttpRewritingToInternal(UrlRewriteEventArgs)
Raises the HttpRewritingToInternal event.
Declaration
protected virtual void OnHttpRewritingToInternal(UrlRewriteEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
UrlRewriteEventArgs | e | The UrlRewriteEventArgs instance containing the event data. |
OnHttpRewroteToExternal(UrlRewriteEventArgs)
Raises the HttpRewroteToExternal event.
Declaration
protected virtual void OnHttpRewroteToExternal(UrlRewriteEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
UrlRewriteEventArgs | e | The UrlRewriteEventArgs instance containing the event data. |
OnHttpRewroteToInternal(UrlRewriteEventArgs)
Raises the HttpRewroteToInternal event.
Declaration
protected virtual void OnHttpRewroteToInternal(UrlRewriteEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
UrlRewriteEventArgs | e | The UrlRewriteEventArgs instance containing the event data. |
PostRequestHandlerExecuteEventHandler(Object, EventArgs)
Handles the PostRequestHandlerExecute event of the application. This is where we decide whether to hookup the rewrite filter for the output stream, based on MIME-type.
Declaration
protected void PostRequestHandlerExecuteEventHandler(object sender, EventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.Object | sender | The source of the event. |
System.EventArgs | e | The System.EventArgs instance containing the event data. |
Events
HtmlAddedRewriteToExternalFilter
Raised after the HTML rewriting filter has been added.
Declaration
public event EventHandler<UrlRewriteEventArgs> HtmlAddedRewriteToExternalFilter
Event Type
Type | Description |
---|---|
System.EventHandler<UrlRewriteEventArgs> |
HtmlAddingRewriteToExternalFilter
Raised before adding the the HTML rewrite-filter.
Declaration
public event EventHandler<UrlRewriteEventArgs> HtmlAddingRewriteToExternalFilter
Event Type
Type | Description |
---|---|
System.EventHandler<UrlRewriteEventArgs> |
Remarks
Extra validation can be performed here. Set e.Cancel to true to stop rewriting from ocurring.
HttpRewriteInit
Initialize events. Use this handler to subscribe to the relevant events. Raised once per instance of the HttpModule.
Declaration
public static event EventHandler<UrlRewriteEventArgs> HttpRewriteInit
Event Type
Type | Description |
---|---|
System.EventHandler<UrlRewriteEventArgs> |
HttpRewritingToExternal
Raised before rewriting the request URL from internal to external
Declaration
public event EventHandler<UrlRewriteEventArgs> HttpRewritingToExternal
Event Type
Type | Description |
---|---|
System.EventHandler<UrlRewriteEventArgs> |
Remarks
Extra validation can be performed here, as well as pre-steps in the rewriting process. Set e.Cancel to true to stop rewriting from ocurring.
HttpRewritingToInternal
Raised before rewriting the request URL from external to internal
Declaration
public event EventHandler<UrlRewriteEventArgs> HttpRewritingToInternal
Event Type
Type | Description |
---|---|
System.EventHandler<UrlRewriteEventArgs> |
Remarks
Extra validation can be performed here, as well as pre-steps in the rewriting process. Set e.Cancel to true to stop rewriting from ocurring.
HttpRewroteToExternal
Raised after rewriting the request URL from internal to external
Declaration
public event EventHandler<UrlRewriteEventArgs> HttpRewroteToExternal
Event Type
Type | Description |
---|---|
System.EventHandler<UrlRewriteEventArgs> |
HttpRewroteToInternal
Raised after rewriting the request URL from external to internal
Declaration
public event EventHandler<UrlRewriteEventArgs> HttpRewroteToInternal
Event Type
Type | Description |
---|---|
System.EventHandler<UrlRewriteEventArgs> |