ASP.Net URLMappings

Alright, Still in process of tweaking my blogging tool, Europa, for SEO success. One of the points on the list from Chris was to make my URL's cleaner. Before today, I was using the standard querystring method of reaching pages. The problem with these, is that search engines have a hard time digesting them (Let alone humans.)

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:

The after effect of URLMappings is as follows:

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:

<?xml version="1.0" standalone="yes"?>
<urlMappings enabled="true">
   <add url="~/346/2007/9/27/Lucky-Man.aspx" mappedUrl="~/blog.aspx?bID=346&amp;Blog=Lucky+Man" />
</urlMappings>

 

Now, I reference URLMapping.xml from the Web.Config file of my website:

<configuration>
   <system.web>
      <urlMappings configSource="URLMapping.xml" />
   </
system.web>
</configuration>

 

 

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.


Tags: Technology, SEO, URLMappings, Microsoft, C#, ASP.NET, Europa, Blog, Visual Studio