modulexcite / hotmod Goto Github PK
View Code? Open in Web Editor NEWThis project forked from andrewdavey/hotmod
HTML Output Modification Module for ASP.NET
License: MIT License
This project forked from andrewdavey/hotmod
HTML Output Modification Module for ASP.NET
License: MIT License
Hotmod - HTML output transformation module. Hotmod is an HTTP Module for ASP.NET. It captures the HTML output of aspx pages, MVC views and any "text/html" content created by the web request pipeline. The HTML is parsed into a System.Xml.Linq.XDocument and then processed by "modifiers" before being reformatted and sent to the client. The resulting HTML can be "pretty printed" (nicely indented) or have all insignificant whitespace removed. Modifiers are implementations of the the Hotmod.IModifier interface. They have a single Modify method that receives the XDocument and returns a modified XDocument. For example, you can create a modifier that appends a timestamp comment to the end of the page. Or, do more complex things like find all <a> href's and change the URLs from app relative to absolute. Using XLinq makes it very easy to alter the HTML elements and attributes. To use hotmod: 1) Reference hotmod.dll from your asp.net web application. 2) Then update your web.config file to use hotmod. The following basic web.config file explains the different bits to add... <?xml version="1.0"?> <configuration> <configSections> <!-- Tell the config system about the "hotmod" section. --> <section name="hotmod" type="Hotmod.Configuration.HotmodSection, Hotmod"/> </configSections> <system.web> <httpModules> <!-- You must add the hotmod module here so it can hook into the request pipeline and modify your HTML output. --> <add name="hot" type="Hotmod.Module, Hotmod"/> </httpModules> </system.web> <system.webServer> <modules> <!-- Hook hotmod into the IIS 7 pipeline using this module --> <add name="hot" type="Hotmod.Module, Hotmod"/> </modules> </system.webServer> <!-- Configure hotmod. Attributes: prettyPrint Defines how to format the output. InDebugMode (Default) Enables pretty print when then web application config is set to Debug mode. In Release mode RemoveWhitespace is used instead. On Always pretty print HTML output. RemoveWhitespace Remove all insignificant whitespace from HTML output. htmlParseError Defines how to handle parse errors in HTML. e.g. Unclosed tags. Throw (Default) Throw the XmlException that describes the problem. AppendException Output the original HTML and append the exception ToString content in a comment. OutputOriginal Output the original HTML with not modifications. <modifiers/> Each modifier defines a name and a type. "name" can be any string identifier unique in the collection. "type" must be the Type full name string of an implementation of the Hotmod.IModifier interface. By default the NormalizeTextWhitespace modifier is added to the collection. To remove this include <remove name="NormalizeTextWhitespace"/> or <clear/>. --> <hotmod prettyPrint="InDebugMode" htmlParseError="AppendException"> <modifiers> <!-- add any custom implementations of Hotmod.IModifier here --> <add name="TimeStamper" type="Demo.TimeStamper, Demo" /> </modifiers> </hotmod> </configuration> ------------------------------------------------------------------------------- If you like hotmod and want to let me know, I'm on twitter @andrewdavey :) Thanks to @bentalyoruk for thinking of the name "hotmod" http://twitter.com/bentayloruk/status/29092863112
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.