PickledHedgehog.HttpPipeline.Core was a fevered dream of a madman. Mainly me. (I didnt actually have a fever either). Basically, I thought of creating this "wrapper" around the System.Web.IHttpModule interface, and make it "easier" to create HttpModules. I also thought it would be a great place to start messing around with plugin-based architecture-type doodahs (I know all the technical words to this, y'see)
That was the plan, but, alas now, it has gone past that. Im hoping to create other handlers, and I have done(ish). I have added a ResponseFilter plugin framework to alow the easy creation of Repsonse Filters (Such as my EasyPeasy Meta Tag Inserter), without the need to faff around with Response Streams.
PickledHedgehog.HttpPipeline now comes with 5 modules out of the box!
Core is the main "bits" of the HttpPipeline processor. It will clean up the URLs for you and alow you to use the PickledHedgehog.HttpModules.UrlRewritingContext to access the source and destination URLs, and it will alow the very very easy creation of HTTPFilters, using the simple interface outlined below, instead of faffing around with output streams, binding them yada yada.
Since there isnt much to this Interface, here goes nothing:

Heres one I prepared earlier:
namespace PickledHedgehog.HttpPipeline.Interfaces
{
public interface IPickledHedgehogUrlRewriter
{
string ProcessRequest(string Source, bool fileExists);
}
}
A change from my last version, I have totally abstracted out the HttpContext, now the interface requires the modules to return a string based on what URL they want to be redirected to, and it will be done (hopefully). If you return null, they will not be redirected (usefull for if the file exists, etc)
A new addition:
The IPickledHedgehogResponseFilter alows easy to use creation of Response filters, an example of this is the MetaTagsInserter which will insert 2 meta tags (keywords, and description) just before the </head> tag, alowing you a very easy way to insert meta tags in all pages that are handled by the .net framework!
I have stolen an idea from ASP.NET and added a "Context" (a virtual singleton), that will, at the moment, only hold the requested path, and the url it was rewritten to:
An example of this in use is:
There are now 5 samples for the HttpPipeline, including source, and these are available at
this link
Web.Config changes - UrlRewriting
I have decided to split up the Web.Config changes section into two parts - the URL Rewriting section, and the Response filter section.
To add the UrlRewriting functionality to any site, you will have to do the following Web.Config changes:
Add the following:
<configSections>
<section name="PickledHedgehog.HttpPipeline" type="PickledHedgehog.HttpPipeline.Core.PickledHedgehogHttpPipelineConfigurationSection, PickledHedgehog.HttpPipeline.Core"/>
</configSections>
And:
<PickledHedgehog.HttpPipeline>
<UrlRewriter File="PickledHedgehog.HttpPipeline.HttpModules.DefaultHandler" Type="PickledHedgehog.HttpPipeline.HttpModules.DefaultHandler.UrlRewriter" />
</PickledHedgehog.HttpPipeline>
Under the Configuration root node. Point the File and the Type settings to the right file/type inside that file, and bob is your uncle!
One last change is to add the following under the System.Web node:
<httpModules>
<add name="PickledHedgehog.HttpPipeline" type="PickledHedgehog.HttpPipeline.Core.UrlRewriterHttpModule"/>
</httpModules>
Dont forget to add the files to the bin directory!
The addition of the Response Filter is slightly more tricky:
Add the following:
<configSections>
<section name="PickledHedgehog.HttpPipeline" type="PickledHedgehog.HttpPipeline.Core.PickledHedgehogHttpPipelineConfigurationSection, PickledHedgehog.HttpPipeline.Core"/>
</configSections>
And:
<PickledHedgehog.HttpPipeline>
<ResponseFilter File="PickledHedgehog.HttpPipeline.ResponseFilter.MetaTagsInserter" Type="PickledHedgehog.HttpPipeline.ResponseFilter.MetaTagsInserter.TagInserter" />
</PickledHedgehog.HttpPipeline>
Under the configuration root node. Point the file and type to the proper dll/typees, and then add the following under the system.web node:
<httpModules>
<add name="PickledHedgehog.HttpPipeline.Response" type="PickledHedgehog.HttpPipeline.Core.HttpModule.ResponseFilterHttpModule"/>
</httpModules>
If you want to get the TagInserter to work, you will need to add the following in your AppSettings:
<add key="PickledHedgehog.HttpPipeline.ResponseFilter.MetaTagsInserter.Description" value="Pickled Hedgehog Home of the world-not-so-famous Config Section Generator"/>
<add key="PickledHedgehog.HttpPipeline.ResponseFilter.MetaTagsInserter.Keywords" value="URL, urlrewriter, configsection, config section, config, section, url, rewriting, http, filter, httpfilter"/>
If you have any issues, please
Email me, or log a
Software Correction Request.
If you would like to download this, for some reason, please
clicky here.
Currently, the only live issue we have at the moment with this is
[PIP-60] DefaultHandler not coping with subdirectories and there is a fix on the bug comments.