Url Rewriting vs the Virtual Path Provider
In my last post I discussed the virtual path provider in ASP.NET 2.0 the difference between using url rewriting and using the VPP (Virtual Path Provider model) to handle urls for content that doesn't physically exist in the normal folder structure. I've been thinking more about this and my thoughts are crystalizing, so I thought I would flesh them out in a post.
The more I think about it, I think comparing the two things is like comparing apples and oranges. Url rewriting is for taking a url you get and saying "no, I really want you to go here" under the hood. It's about redirection, though it isn't exactly redirection. The VPP system is about creating an extensible ASP.NET page lookup mechanism that keeps you from having to rely on the file system. If my definitions are basically correct, then using url rewriting for handling virtual pages in ASP.NET 2.0 is like using a wrench for a hammer to knock a nail into some wood (which is what I do when I can't find my hammer); it is using a tool for doing something that works but isn't the most ideal for a job. I don't think there was any other way of doing this in 1.1 because the VPP tool was not available, but now that it is (and given what the two techniques actually do), the VPP is the tool we should be using.
Now url rewriting obviously works for this, and is used for this thing on apache as well. And if someone has a system to do this built around url rewriting, it may not be worth rewriting just because ASP.NET 2.0 gives you a shiny new tool. But going forward, this makes sense. If you want to point a request in a different direction, use url rewriting. If you want to show content that doesn't depend on the physical file system structure, use the VPP.