I ran across something very interesting a couple days ago in ASP.NET 2.0 called the VirtualPathProvider. Essentially, it's some ASP.NET infrastructure that abstracts ASP.NET from using the file system directly, and it allows you to "hook in" to it all and serve pages from something other than the file system.
Because the documentation is a little sparse, and because it looked pretty cool, I dug into it, created a sample, and wrote up a short essay about it. The sample can be downloaded from that page.
I think it has some very interesting possibilities. In particular I'm thinking of using it for the blog to do what most blogging platforms do with url rewriting. Currently the pages are viewed on the site through a generic viewer page with a variable in the query string (which is less cool). This would allow me to do something like /2007/3/15/ThisIsMyBlogPostTitle.aspx.
What I would really like to know is what are the advantages and disadvantages of implementing this with either approach. I see how they're both done, and the the virtual path provider way seems like a cleaner approach. Am I missing something? I know for many, like Community Server, that this would not have been an option when the platform was originally written since this is new in 2.0. But I haven't really heard much of a peep on this thing. Is no one else thinking about it? Are you community server folks thinking about it? Anyway, I would love to hear anyone's thoughts. It seems like a cool technology...

Anderson Imes
The VPP has been a big tool I've used in the last couple of months. It's definitely exciting and has a lot of uses. It's hard to know when to use URL rewriting vs. the VPP. I think you can basically break it down like this:
Sometimes you have to use these things in tandem, as well. It really just depends on your need.
Hope this helps.
Eric
Anderson Imes
I think that's pretty much what I was saying. Redirect to a different place: rewriting. Execute content located somewhere besides the filesystem: VPP.
Your writeup is very accurate. Good job.
Xander
Eric
Victor Mx
Hi everyone,
I'm currently chossing between VPP and URL rewriting, but can you help me to choice?.
I try both of them and this are my experience:
With URL rewriting, i try it and i have the problem with postbacks, when the user make a postback, the page loaded was the real not the virtual :(
i.e. the virtual was: MyApp/hotel/Mexico/FiveStarHotel.aspx
the same real with query string is MyApp/hotel/info.aspx?hotel=FiveStarHotel.aspx
I use the tip of replace the Form action direction, but i get a new problem, the relative paths can be resolved because the folder count in my virtual (3) in my real (2) :( :(
With VPP in the same escenario, i can't handle the events of the page because the page it's loaded like file not an aspx page
Any suggestion?
Help me pls
P.D. Sorry my english are not so good
Eric
Xander
>. VPP's do not automatically do page caching, which means you can do page caching if you want, or just data caching, or a combination of both. What can you do in this respect with url rewriting that you can't do with the VPP?
They *do* in fact get cached. Not in the traditional output cache sense, (standard runtime bits all still run, data can be output cached or grabbed fresh or what have you) but the virtual file itself is cached....The equivelent of what would have been the standard ASPX page.
Eric
Luke
I know I am a bit late on this one but hopefully this still gets through.....
Firstly, great post, provides a bit more of an insight than the MSDN docs which helped me alot. I am using VPP for a few things, mostly for control libraries that you can distribute via dll's and I've run into some problems with VPP master pages not finding their associated css/image files when you deploy the project to a remote server. Everything works fine in my localhost but I just get 404 errors as soon as I upload....just wondering if you ever tried anything along these lines
Cheers