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

Class HtmlRewriteToExternal

Abstract base class for URL-rewriting of URIs in streams and strings.

Inheritance
System.Object
HtmlRewriteToExternal
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: EPiServer.Web
Assembly: EPiServer.Cms.AspNet.dll
Version: 11.20.7
Syntax
public abstract class HtmlRewriteToExternal

Constructors

HtmlRewriteToExternal()

Declaration
protected HtmlRewriteToExternal()

Methods

GetRewriteFilter(UrlBuilder, UrlBuilder, Encoding, Stream, out RewritePipe)

Gets a rewrite filter stream

Declaration
public virtual Stream GetRewriteFilter(UrlBuilder internalUrl, UrlBuilder externalUrl, Encoding encoding, Stream stream, out RewritePipe rewritePipe)
Parameters
Type Name Description
UrlBuilder internalUrl

The internal URL.

UrlBuilder externalUrl

The external URL.

System.Text.Encoding encoding

The encoding to use when escaping URI:s

System.IO.Stream stream

The incoming stream.

RewritePipe rewritePipe

The rewrite pipe.

Returns
Type Description
System.IO.Stream

The filtered, rewritten, stream

OnHtmlRewriteInit(HtmlRewriteEventArgs)

Raises the HtmlRewriteInit event. Override in derived classes to add your handlers.

Declaration
protected virtual void OnHtmlRewriteInit(HtmlRewriteEventArgs e)
Parameters
Type Name Description
HtmlRewriteEventArgs e

The HtmlRewriteEventArgs instance containing the event data.

OnHtmlRewritingUrl(UrlRewriteEventArgs)

Raises the HtmlRewritingUrl event.

Declaration
protected virtual void OnHtmlRewritingUrl(UrlRewriteEventArgs e)
Parameters
Type Name Description
UrlRewriteEventArgs e

The UrlRewriteEventArgs instance containing the event data.

OnHtmlRewroteUrl(UrlRewriteEventArgs)

Raises the HtmlRewroteUrl event.

Declaration
protected virtual void OnHtmlRewroteUrl(UrlRewriteEventArgs e)
Parameters
Type Name Description
UrlRewriteEventArgs e

The UrlRewriteEventArgs instance containing the event data.

RaiseEvent(EventHandler<UrlRewriteEventArgs>, UrlRewriteEventArgs)

Helper to raise an event.

Declaration
protected bool RaiseEvent(EventHandler<UrlRewriteEventArgs> handler, UrlRewriteEventArgs e)
Parameters
Type Name Description
System.EventHandler<UrlRewriteEventArgs> handler

The handler.

UrlRewriteEventArgs e

The UrlRewriteEventArgs instance containing the event data.

Returns
Type Description
System.Boolean

RewriteString(UrlBuilder, UrlBuilder, Encoding, String)

Rewrites the URIs in a HTML string. It does so in the context of an internal and external URL, providing the necessary rebasing for relative URIs.

Declaration
public virtual string RewriteString(UrlBuilder internalUrl, UrlBuilder externalUrl, Encoding encoding, string html)
Parameters
Type Name Description
UrlBuilder internalUrl

The internal context URL.

UrlBuilder externalUrl

The external context URL.

System.Text.Encoding encoding

The encoding used to escape URIs, and for initial PI if such is included

System.String html

The HTML to be parsed and rewritten

Returns
Type Description
System.String

The rewritten string

Events

HtmlRewriteInit

Raised to enable subscribers to subscribe to specific HtmlRewritePipe and HtmlRewriteFromInternal events.

Declaration
public static event EventHandler<HtmlRewriteEventArgs> HtmlRewriteInit
Event Type
Type Description
System.EventHandler<HtmlRewriteEventArgs>

HtmlRewritingUrl

Raised when rewriting a URL in HTML. Use this event to do preliminary rewriting, or replace the rewriting entirely, or even cancel the rewriting entirely.

Declaration
public event EventHandler<UrlRewriteEventArgs> HtmlRewritingUrl
Event Type
Type Description
System.EventHandler<UrlRewriteEventArgs>

HtmlRewroteUrl

Raised when we've rewritten a URL in HTML. Use this event to do post-processing of the now rewritten URL.

Declaration
public event EventHandler<UrlRewriteEventArgs> HtmlRewroteUrl
Event Type
Type Description
System.EventHandler<UrlRewriteEventArgs>

Extension Methods