At first, this project of converting my links sounded very tedious. Initially I was thinking I'd have to write some elaborate routine on publishing an HTML page after writing a blog, similar to how blogger does it. Not only would I have to make an HTML page for each blog, but I would have to update the extra content (such as "last 10 blogs") in case I wanted to archive them, keep tabs on a main page, rss feed, etc etc etc. Didn't sound appetising at all.
Dissapointed and overcome by this method, I set on a search to find a nice and easy route. Lo' and behold, Microsoft never ceases to amaze me. URLmappings totally made my life easier. They allow you to set a sort of virtual path to your page, yet, still taking in querystring information.
For example, the link to my recent blog, "Lucky Man". It's original (and working) path is:
http://www.nicholasdavis.info/blog.aspx?bID=346&Blog=Lucky+Man
The after effect of URLMappings is as follows:
http://www.nicholasdavis.info/346/2007/9/27/Lucky-Man.aspx
Sweet, huh? All I had to do was create an XML file that is referencable to my web.config file. For example, I have a file called URLMapping.xml. This contains all my URL Maps. Example:
Now, I reference URLMapping.xml from the Web.Config file of my website:
That's all there is to it! So now when I save a blog, it opens the URLMapping.xml into a Dataset, quick add the links and save it back. Couldn't be easier.
posted at 9/30/2007 3 Comments