views:

21

answers:

1

I need to split a portion of functionality away from a legacy ISAPI dll onto another solution (ASP.NET MVC most likely). IIS7's URL Rewrite sounded like a perfect candidate for the job, but it turns out I cannot find a way to configure the rules the way I need. I need to write a rule that examines the content of the HTTP post for a particular value.

i.e.

<form method="post" action="legacy_isapi.dll">
  <input name="foo" />
</form>

if (Request.Form["foo"] == "bar")
    Context.RewritePath("/some_other_url/on_the_same_machine/foo/bar");

As a proof of concept, I was able to create an IHttpModule that examines context.Request.Form collection and performs a rewrite when certain parameters are present. I installed this module in my website, and it works.

Rather than a custom module, however, I'd rather extend the existing URL Rewrite module to support examining the content of the HTTP Post as one of its rules. Is this possible?

A: 

Doesn't appear to be possible - looks like only the headers are examined.

http://learn.iis.net/page.aspx/465/url-rewrite-module-configuration-reference/#Rewrite_Rules_Overview

you can check for certain values of HTTP headers or server variables

If you can switch from POST to GET, you could then check QUERY_STRING

James Manning