13 May 2011 by Web Bureau
There are number of ways to store the rewriting rules like appending them to the end of your web.config file, a text file or even saving these rules in the database. But the one method I preferred was to create a new .xml file with the list of these rules (in nodes) and placing it on the root of the site.
These rules are used to nominate pages/files to the URL which the web user requests by typing in the address bar of the browser. This is accomplished by iterating through the rules in the Global.asax file and selecting the one to rewrite which best matches the requested one. Regular Expressions can be used in this file to implement different redirection methods. Your .xml file should look something like:
The <urlrewrites> is the root node I used which has lists of "rule" nodes representing each rule. Like for example the second rule for "aboutme(.*)" means the URL http://www.mysite.com/aboutme/ should rewrite to the proper /mysite/pages/aboutme.aspx.
But this is not all, that is, it won’t just simply pickup the /mysite/pages/aboutme.aspx to rewrite when the web user requests the link above. We will need to code our way in the Global.asax file.
This step is required if you want to rewrite the extension-less URLs properly. In other words, in order to browse using http://www.abdullahnoor.com/aboutme/ instead of http://www.abdullahnoor.com/aboutme.aspx what you will need to do here is to:
After you have followed all of the steps above as explained and you are still getting an IIS related error (common in Vista and Win7) then it is probably due the "Managed Pipeline Mode" option in Application Pools: