Using ISAPI filter with .net for URL Rewriting

J

Jon Maz

Hi All,

I've been looking into options for URL Rewriting in .net, and to be honest,
I haven't seen anything that's easier than the old Classic Asp solution with
an ISAPI filter redirecting to an .asp page with responsibility for handling
the redirect.

I'm now planning to use this solution with my next .net project, and was
wondering if anyone else out there has done this already, and what problems
(if any) arise. Hopefully the news is that the solution works just as
easily as before.

I *am* aware that there is a dotnet alternative to an ISAPI filter. I found
a decent Scott Mitchell article
(http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnaspp/htm
l/urlrewriting.asp) on a URL Rewriting using Http modules, but I have some
reservations about using this method:

(a) it seems a lot more complex than the ISAPI solution.
(b) if you want to be able to handle URL's of the form
"www.apple.com/products", you still have to create a physical "products"
folder AND put an empty Default.aspx file in it, neither of which are true
of the ISAPI solution.
(c) depending how you implement the .net solution, Forms or Windows
Authentication may cease to work.
(d) to solve a postback issue you have to use an Actionless Server-side Form
instead of the standard .net one throughout your site.

So, does anyone have experience using an ISAPI Filter with .net, and was it
a good, bad or indifferent experience?

TIA,

JON

PS First posted to aspmessageboard:
http://www.aspmessageboard.com/forum/ASPPlus.asp?M=731069&T=731069&F=36&P=1
 
S

Scott Allen

HI Jon:

a) The complexity depends on how much you want to do with the URL
re-writing. To me, URL rewriting from managed code isn't even in the
same order of complexity as an ISAPI filter. An HttpModule is easier
to configure, easier to write, easier to debug, and more robust at
runtime.

b) You can avoid creating physical directories by mapping all requests
through the ASP.NET runtime (in the script map settings of IIS).

c) This I have not seen a problem with, but you would have to be
careful where the RewritePath occurs, I imagine the same could be said
of the ISAPI solution.

d) Scott's article is great, but it does miss one simple solution to
this problem. Once you are inside the destgination page, simply
rewrite the path back to the original raw URL. This does not actually
'redirect' the request, but it does allow the runtime to write out the
correct action attribute in the form tag. It's a simple, one line
solution to the problem. I blogged about this here:

The Passion and the Fury of URL Rewriting
http://odetocode.com/Blogs/scott/archive/2004/09/22/509.aspx

HTH,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,072
Latest member
trafficcone

Latest Threads

Top