How can I shut off EPiServer's HTML rewriting for certain content?

Vote:
 

Is it possible to shut off EPiServer's HTML re-writing on a page or even tag basis?

My client has several standalone HTML pages on their site which contain Java applets supplied by a third-party vendor.  The HTML to embed these applets is truly ridiculous.  In one place they have an entire HTML document embedded inside the "value" attribute of a "param" tag.  I'm not joking.

In other places, they use conditional comments to show and hide various things for different browsers, and they get the syntax of the comments all wrong.  I managed to this fix, but the HTML document in an attribute thing is something I just have to live with because the applet won't work without it.

Obviously, EPiServer's HTML re-writer is totally confused by all of this.  I diffed the source file against what EPiServer delivers, and I can see where it's re-writing and where it's getting confused.  I don't blame EPiServer -- this HTML is so far out of standards I'm amazed it works at all.

But, the client has to have these, so I want to shut off HTML re-writing, in one of two ways:

1. On a folder or file basis -- so, don't rewrite for Folder X or File X.

2. On a tag basis -- so, stop rewriting when you encounter Tag X (or some comment), and start again when you get to Tag Y.

I looked through the HttpModules, but I can't see where EPiServer is attaching the RewritePipe.  All these HTML files are in the directory, so if it's just a matter of shutting off some module, I can easily isolate them.\

I know the HTML rewriting is attached by content type, but I these have to be delivered as "text/html," so I can't do that either.

#41534
Jul 09, 2010 18:04
Vote:
 

Hmmm... nasty... if you want to add this kind of conditional logic into the URL rewriting then you might be looking at customising the URL rewriters.

There are a number of ways of skinning this cat - the SDK covers the overview of it here: http://sdk.episerver.com/library/cms6/Developers%20Guide/Advanced%20Features/UrlRewrite/Friendly%20URL.htm

Basically, you have three choices - you can try hooking into the URL rewriter events (easy), customising them through inheritance (easy-ish) or writing your own implementation (to be avoided).

There's a good piece on creating a custom URL rewrite implementation here that may explain more about how it hangs together:

http://labs.episerver.com/en/Blogs/Ted-Nyberg/Dates/112276/7/Implementing-a-custom-URL-rewrite-provider-for-EPiServer/

 

 

#41537
Jul 09, 2010 19:00
Vote:
 

I'm talking about HTML rewriting, not URL rewriting.

#41539
Jul 09, 2010 20:43
Vote:
 

Ben is correct. What you want is to override the way EPiServer handles your HTML files - you need to create your own custom URL rewriter for this (inherit from the existing one and only overwrite what you have to, use Reflector).

Frederik

#41540
Jul 09, 2010 23:09
Vote:
 

I know this might not be what you're looking for, but maybe you can add a new property that is xhtml/string and use that property as your "don't rewrite my html" section and place all your special code in there. Make sure in that new property that you UNCHECK all the boxes for the editor, such as Bold, Italics, Underline, Font, etc. etc.

This will place only the source code you put in that box on the page. The only problem is where you decide to add this property. If you add it below Mainbody property then all the code you place in this box will display below the Mainbody content. It's an option though, instead of having to create your own custom URL rewriter.

#41639
Jul 19, 2010 15:07