Skip to content
Erning.write()
Go back

URL Rewrite Module for ASP.NET 2.0

mod_rewrite is one of the most useful modules for Apache.

But what do you do on a Windows IIS server? I could only find a few commercial ISAPI modules (ISAPI ReWrite, IIS Rewrite). This is one of the most painful gaps on the Windows platform.

Since I only needed a few rewrite features at the time, I decided to build my own. An early version is available from the CVS repository — anonymous CVS, no password required.

The RewriteCond feature has not been implemented yet. Sorry — it was only an afternoon’s work, and I am still a newbie on the ASP.NET platform.

Here is the sample configuration:

<configuration>
    <configsections>
<section
            name="rewriteSection"
            type="Dragonsoft.RewriteConfigurationSection, Dragonsoft.RewriteModule" />
    </configsections>

    <system .web>
        <httpmodules>
            <add name="rewrite" type="Dragonsoft.RewriteModule" />
        </httpmodules>
    </system>

    <rewritesection>
        <![CDATA[
        RewriteRule ^~/news/([^/]+)/([^/]+)\.html$ ~/news.aspx?id=$1&#038;name=$2 [L]
        RewriteRule \fake\(.*).html$ \real\$1.aspx [NC,L]
        ]]&gt;
    </rewritesection>
</configuration>

–update: URL Rewrite Filter for IIS is open source. I have not tested it.


Share this post on:

Previous Post
让 Google 显示英文界面
Next Post
CDMA Dialup Internet on Gentoo Linux