Search engine friendly URLs using ASP.NET (C#.NET)
Each year millions of dollars are spent on websites that depend on databases
to offer dynamic content. Yet these sites never receive the exposure they deserve.
The database driven sites are used because their administration is much easier
than the sites with static content. If you want to update the content of a database
driven web site, you only need to make changes to certain tables in the database.
Unfortunately, most of these databases driven web sites rely heavily on parameters
to display content since parameter passing is the easiest way to pass information
between web pages. Yet, most search engines cannot or will not list any dynamic URLS.
Dynamic URLs are said to contain elements such as?, &, %, +, =, $, cgi-bin, .cgi.
Hence, the pages the hyperlinks point to will be ignored by the Web spider while indexing the site.
We need that instead of sending parameters like
http://www.mydomain.com/?pageid=4
which is not search engine friendly, we want to change it to http://www.mydomain.com/page4.aspx.
Prerequisites
In order to achieve this, you need to first modify the Application_BeginRequest
event in your Global.asax file as the following:
In the above code, URLs of incoming requests are scanned to
determine if the URL includes "pageX.aspx", where X=1,2,3...n.
Now, you need to create a file Process.aspx
which would display your web site content based on the pageid parameter (pageid=1...n)
just like you would do normally.
Finally, you need to issue a test request to http://www.yourdomain.com/page12.aspx.
Now, you can observe that even though you are issuing a search engine friendly request,
in the background you are accessing your parameters like you would normally do.