Is it possible to write an IIS URL Rewrite Rule that examines content of HTTP Post?
Posted
by JohnRudolfLewis
on Stack Overflow
See other posts from Stack Overflow
or by JohnRudolfLewis
Published on 2010-06-02T21:07:34Z
Indexed on
2010/06/02
21:14 UTC
Read the original article
Hit count: 340
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?
© Stack Overflow or respective owner