ASP.NET
From Well Designed Urls WiKi
Contents |
Problems with ASP.NET
- __doPostBack()
- Inability to get rid of .aspx extension
- VIEWSTATE
- and more.
Getting control of URLs with ASP.NET
On shared hosting this is not easy to configure, mostly likely impossible. If you have full control of your server you might be better off with an ISAPI filter solution since the commercial tools offer declarative configuration like mod_rewrite and don't force you to write your application in a 'strange' way (that is if you actually believe ASP.NET is nirvana!).
The following is a high level overview of what you need to do with IIS 6.0 and ASP.NET 1.1/2.0. (It may not work with IIS 5.0!)
- Map all requests to the ASP.NET runtime within the IIS properties. This means the ASP.NET runtime handles requests for .gif, .htm etc.
- Write custom HttpHandlers that handle all types of requests that come in. You'll need to parse the requests and handle mime-types etc. This is very involved and only for the die hards out there. Unless you know what you are doing and have appropriate testing resources you can let a lot of security bugs creep in.
- Depending on how you implement your application, performance issues could arise.
If you can put up with .aspx/.ashx file extensions you can write 'more standard' ASP.NET modules. However you'll hit file path issues and the like down the road. The HttpModules that you find in many articles are simplistic in nature. From the looks of it, Microsoft do much more advanced stuff with them in SharePoint 2007.
Shared Hosting
One of the (many) reasons for my creating this wiki is to encourage those companies whose products and services affect our ability to create good clean URLs are made aware of how important it is. Please contact your desired web host and point out this site to them, and tell them if they don't provide some way to allow you to create clean URLs you'll be taking your money elsewhere! Heck, email this page to every hosting company you know anyway just so they'll know that this is an issue, if you don't mind taking the time!
Or you can just choose to host from one of the Shared Hosting Companies that supports ISAPI Rewrite.
URL Configuration
In alphabetical order:
- ASP.NET 2 + url rewriting considered harmful in some cases (Matt Cutts)
- ASP.NET URL Rewriting and Caching Engine (asp101.com)
- Fixing Microsoft's Bugs: Url Rewriting (Jesse Ezel)
- Making sense of ASP.Net Paths (Rick Strahl)
- Microsoft IIS Web Server and ASP.NET (webmasterworld.com)
- Rewrite.NET - A URL Rewriting Engine for .NET (15seconds.com)
- Rewriting the URL using IHttpHandlerFactory (uberasp.net)
- Search Engine Friendly URLs using ASP.NET (C#.NET) (www.theukwebdesigncompany.com)
- URL Mapping in ASP.NET 2.0 (Developer.com)
- URL Rewriting (csharpfriends.com)
- URL Rewriting in ASP.NET (MSDN/Scott Mitchell)
- URL Rewriting with ASP.NET (codeproject.com)

