Those of us who have used Apache on a Unix platform are familiar with Apache Mod Rewrite, which allows urls to be rewritten using rules and regular expressions. This allows for “pretty urls” instead of long querystring urls that aren’t particularly user or search engine friendly.
A url such as
/index.aspx?type=blog&category=programming
can be rewritten to something like
/blog/programming/
Much easier to read and remember.
ASP.NET 2.0 introduced limited rewrite rules, basically static routes that can be configured in the web.config file.
Until version 7 of IIS, there really hasn’t been a native solutions(IIS 7 requires an extension to be installed) . So if you are using IIS < 7 then you will need to find a custom solution.
If you are using IIS7, it may not have the features that a PHP solution, using apache mod rewrite would need or use, which would force you to try to recreate the functionality. Apparently there is a script that will convert apache rules to IIS7 Rewrite rules, but I haven’t test it out.
Following are a couple of solutions that I have found:
This is a very easy to use solution. It an ASP.net module, so it relies on the .NET framework. I’ve used it on several sites and haven’t had any problem, that weren’t of my own making. Rules are stored in the web.config and the module files are simple put in the application in the “/bin” folder. You can even program against it with intellisense in Visual Studio.
Pros: Free, Easy to install, Good Docs, no need to configure IIS, Can program against it in asp.net
Cons: Only works for .NET enabled sites. All rewrites must point to a .aspx file since the process is part of the .Net pipeline. (so from the above example the rewrite would be: /blog/programming.aspx)
Supports regular expressions, and the syntax is very similar to Apache rewrite syntax found in .htaccess files. I ended up going with UrlRewritingNet since it was so easy to configure and I only wanted it for Asp.net applications.
Pros: Free, documentation is pretty good, syntax is very similar to Apache mod_rewrite rules.
Cons: Lack of good examples, separate copies of the dll must be used and configured to have different configurations per site.
This is a fantastic solution for running Open Source PHP apps, (like Joomla, Drupal, CMS Made Simple etc.), since after installing the ISAPI filter, .htaccess files are natively supported, little or no configuration required, and the software behaves exactly as designed. Supports virtually all the functionality of mod_rewrite, even writing scripts to do rewrites from database results.
Pros: mod_rewrite syntax and .htaccess support. Native IIS6 and IIS7 support. Can write scripts to extend the functionality.
Cons: Not free. Documentation is a bit sparse on the site,( but since it basically supports everything mod_rewrite can do, all the documentation for mod_rewrite comes into play.)
This software has been around for a long time. It was one of the only solutions available before IIS7. Powerful regular expression support and supports IIS permissions to control access to resources etc. Allows for proxying, redirection and conditional statements.
Pros: very powerful and flexible, price is fair, tech support
Cons: Not Free, documentation could certainly be better