Write your own UI Rewrite Template Extension!
The GoLive release of URL Rewrite Module is now available and has a lot of improvement thanks to the IIS Community feedback (and tons of internal brainstorm meetings!). A new feature is the ability to create Rewrite Rules by using Rewrite Templates, Rewrite Templates are UI extensions that help to simplify the creation of rules.
URL Rewrite Module includes 3 templates and more interesting, it allows you to add your own Rewrite Template.
Take a look to the following walkthrough if you haven’t play with Rewrite Templates:
http://learn.iis.net/page.aspx/497/user-friendly-url---rule-template/
I want to show you how easy is to write your own Rewrite Template extension, here is how this demo should look like:

As you know, iis.net has already some good articles that explain how to create an IIS Manager UI Module, so allow me to reuse the following article:
http://learn.iis.net/page.aspx/269/how-to-create-a-simple-iis-manager-module/
Follow the article above and once you are done with it, please do the following changes.
- Add the assembly Microsoft.Web.Management.Rewrite.Client.dll to your C# project. If you can’t find the assembly reference in the GAC, download it from here.
- Replace the code in DemoModule.cs by the following code that registers your extension in the URL Rewrite UI Module:
using System;
using Microsoft.Web.Management.Client;
using Microsoft.Web.Management.Iis.Rewrite.RewriteTemplates;
using Microsoft.Web.Management.Server;
namespace ExtensibilityDemo
{
internal sealed class DemoModule : Module
{
protected override void Initialize(IServiceProvider serviceProvider, ModuleInfo moduleInfo)
{
base.Initialize(serviceProvider, moduleInfo);
IExtensibilityManager extensibilityManager = (IExtensibilityManager)
GetService(typeof(IExtensibilityManager));
extensibilityManager.RegisterExtension(typeof(RewriteTemplateFeature),
new DemoRewriteTemplateFeature(this));
}
}
}
- Add a new file named DemoRewriteTemplateFeature.cs and copy and paste following code:
using Microsoft.Web.Management.Client;
using Microsoft.Web.Management.Iis.Rewrite.RewriteTemplates;
using System.Windows.Forms;
namespace ExtensibilityDemo
{
internal sealed class DemoRewriteTemplateFeature : RewriteTemplateFeature
{
private const string FeatureTitle = "Rewrite Extensibility Demo";
private const string FeatureDescription = "Demonstrates the UI Extensibility.";
public DemoRewriteTemplateFeature(Module module)
: base(module, FeatureTitle, FeatureDescription, null, null)
{
}
public override void Run()
{
Form form = new Form();
form.Text = "URL Rewrite Extensibility Demo";
form.StartPosition = FormStartPosition.CenterParent;
form.ShowDialog();
}
}
}
Colorized by: CarlosAg.CodeColorizer
Download the demo from here:
To install it, you will need to GAC the assembly RewriteExtensibilityDemo.dll and register the module in administration.config by adding the following entry under the moduleProviders section:
<add name="RewriteExtensibilityDemo"
type="ExtensibilityDemo.DemoModuleProvider, RewriteExtensibilityDemo, Version=1.0.0.0, Culture=neutral, PublicKeyToken=8975c3932a2fc4ae" />