More about the bad support for URL-rewrite in ASP.NET

I really love developing on ASP.NET with C# and will definitely continue using this technique from Microsoft. But everything can not be perfect. The greatest shortcoming of the framework is to me that there isn't any good native support for URL-rewriting. I have written a bit about it before.

It's especially in the IIS 6 web server that the limitations exists. In the newer IIS 7 that will be released together with the Longhorn server there will be better solutions to create rules for URL rewrites. But there are some time left until this system will be released, so that doesn't help us right now.

What you can do at the moment is to use ASAPI-filters but that postulates that you are running your own dedicated server or are on a web host that will install it for you. Jeff Atwood at Coding Horror writes more about the two most common ASAPI-solutions for IIS.

One of the greatest critics of the situation is probably Mike Schinkel. This is the guy that started the and the companion blog which contains a lot of great resources on the subject.

On his personal blog Mike is not holding back on the critizism. In a recent post with the headline "IIS 7.0: Too Little, Too Late?" another Mike (Program Manager för Microsoft’s IIS team) enters the discussion and is expressing his regrets over the bad situation.

The first Mike is continuing in another post to make a list of all the alternative server-techniques and asks his readers which one they recommed he will switch to instead of ASP.NET.

I think it's really good that a lot of developers pays attention to the problem. Microsoft tells us that IIS 7 will not be available for Windows 2003 and that's a real pity. The new techniques are to deep related to the Longhorn system that are saying.

But who knows, after all this begging from developers perhaps Microsoft can spare some resources on it. I would be absolutely wonderful. My tip is to try to do a simpler upgrade to IIS 6 and try to make an implementation of the same URL-rewrite as in the upcoming web server. Name it something like IIS 6.5.

By Jesper Lind

Beautiful URL:s with ASP.NET (we're not there yet)

Some time ago I wrote about how to do URL rewrite with ASP.NET (and about the problems that are involved). Many developers has tried to tackle the problem and I will not go to ddep into the technical stuff this time. I will how ever save a few new links I found on the subject.

First an article that isn't related to ASP.NET but shows how well-designed urls should look like.

Then an link to an Wiki completely dedicated to well designed urls, where you can read "ASP.NET - Well Designed Urls Wiki".

My conclusion is that it's probably smartest to wait until IIS 7 is released. Unfortunatly it doen't seems like we will get this web server for Windows 2003. We will probably have to wait for the new Longhorn server.

IIS 7.0 will have much better support for URL-rewrite as you can read on Scott Guthrie's blog:

Several people have asked why the built-in URL Mapper in ASP.NET 2.0 doesn't support regular expressions. There were actually a few reasons for this -- one of the big ones being that just about the time we were about to consider adding it my team started also working on IIS7. We realized that a full-featured version would want/need to take advantage of some of the new features in IIS7 as well as the support all content types (in particular -- images and directories). So we postponed making it feature rich until a future version.

I am rather happy that I havn't started to try to rewrite URLs with IIS 6 yet, especially when I read reports as "Making URL rewriting on IIS 7 work like IIS 6".

The question is if one really can wait. To have nicely formatted URLs is really tempting, especially from an SEO-perspective. But if you are going to use one of this tecniques just bear in mind that you might have to redo everything once IIS 7 is released.

If you want to have some thought from someone who has started using URL-rewrite with IIS 7 on Vista, you can read Dennis blog.

By Jesper Lind

How to do URL-rewrite with ASP.NET?

To have the .aspx-prefix at the end and a lot of querystring parameters at the end of the URLs feels rather ungraceful. And it's not any good from a SEO-point of view. IIS 6 and ASP.NET has not got any good built in solution to do URL rewrite. But there are some solutions and I will collect a few links here that I read on the subject.

In Ruby on Rails URL-rewrite seems simple and is a natural part of the language. On Apache servers there are the mod_rewrite module which is great for all the PHP-developers.

With ASP.NET it's possible to use HttpContext.RewritePatt, but it's not as simple as it first appears. I found a lot of articles about soultiuons but many of them described problems with cacheing, themes and problems with Postback.

On there's an open source component that claimes to have solved a lot of these problems. I have not tried this myself though.

I have also read about the coming IIS 7.0 and that there will be a better support for URL rewrite. Lets hope so!

Some mixed references


By Jesper Lind