codetoad.com
  ASP Shopping CartForum & BBS
  - all for $20 from CodeToad Plus!
  
  Home || ASP | ASP.Net | C++/C# | DHTML | HTML | Java | Javascript | Perl | VB | XML || CodeToad Plus! || Forums || RAM 
Search Site:



Home » ASP » Article

Search engine friendly URLs using ASP.NET (C#.NET)

Article by: Maziar Aflatoun (11/4/2003)
Bookmark us now! Add to Favourites
Email a friend!Tell a friend
Summary: This article describes how one would create a search engine friendly ASP.NET (C# .NET) web site.
Viewed: 216625 times Rating (50 votes): 
 3.8 out of 5
 Rate this Article  Read Comments  Post Comments

Search engine friendly URLs using ASP.NET (C#.NET)



Each year companies and individuals spend millions of dollars on websites that depend on databases to offer dynamic content. Yet these sites never receive the exposure they deserve. Database driven sites are used because their administration is much easier than the sites with static content. Usually, all it takes to update the contents of a database driven web site it making changes to certain tables in the database.

Unfortunately, most of these database driven web sites rely heavily on parameters to display contents 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 which the hyperlinks point to will be ignored by the Web spider indexing the site.

I have been searching many top search engines for information on creating a search engine friendly web site using ASP.NET (C#. NET) and have not been able to find anything. So, I thought it would be a good idea to create an article and share it with the rest of the world.

Goal

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 your Global.asax file, modify the Application_BeginRequest event as the following,


Select All Code


In the above code, URLs of incoming requests are scanned to determine if the URL includes “pageX.aspx”, where X=1,2,3…n

Your code

Next 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.

Ex.


Select All Code


To test this out, issue a test request my calling the page:
http://www.yourdomain.com/page12.aspx

Here even though you are issuing a search engine friendly request, in the background you’re managing your parameters like you would normally do with parameters.






CodeToad Experts

Can't find the answer?
Our Site experts are answering questions for free in the CodeToad forums
Rate this article:     Poor Excellent
View highlighted Comments
User Comments on 'Search engine friendly URLs using ASP.NET (C#.NET)'
Posted by :  aleys at 14:27 on Monday, December 01, 2003
Well, I don't know where did you look for, but this information you wrote is not new....

Another solution could be also an ISAPI filter which can rewrite URL without any code.

E.g.

http://www.smalig.com/url_rewrite-en.htm

<Added>

Well, I don't know where did you look for, but this information you wrote is not new....

Another solution could be also an ISAPI filter which can rewrite URL without any code.

E.g.

http://www.smalig.com/url_rewrite-en.htm

--

<Added>

Well, I don't know where did you look for, but this information you wrote is not new....

Another solution could be also an ISAPI filter which can rewrite URL without any code.

E.g.

http://www.smalig.com/url_rewrite-en.htm

--
Posted by :  sliechti at 08:11 on Monday, January 19, 2004
If you are searching for an Url Rewrite flter with Regular Expressions. Check this out: <a href="http://www.iismods.com" target="_blank">Url Rewrite for IIS</a>.
Happy coding.

<Added>

If you are searching for an Url Rewrite flter with Regular Expressions. Check this out: http://www.iismods.com .
Happy coding.
Posted by :  sugumar at 22:22 on Wednesday, February 21, 2007
This article is useful for me thanks for posting this article.
Posted by :  anrorathod at 23:30 on Thursday, August 23, 2007
Hi,

I have read this article and implemented it. This is really fantastic.

But, I am facing problem for image path in following situation,

I have a "client" folder and there is a page in this folder, "test.ascx" and there is a image in this page.
now,I have rewrite the url path and everything is working fine, but there is problem in path... and it shows image path is - "http://localhost/testproject/client/images/win2000.gif"
but it should "http://localhost/testproject/images/win2000.gif".

So, can you please help me for this problem ?

Regards,

Rohit Rathod
Posted by :  abhijitaitwade at 08:16 on Sunday, November 04, 2007
Hi Maziar,


I have http://www.yourdomain.com/productdeatil.aspx?Id=91 this page and i want rewrite it as

http://www.yourdomain.com/productdeatil.aspx/91/

Please guide me for that.

Thnaks,
Abhijit
Posted by :  AbhinavMoudgil at 09:13 on Monday, August 11, 2008
Hi,

Thanks for such a valuable data ....
For all those who are new for SEO and want to improve your site then this blog will really be helpful to you http://completeseotipss.blogspot.com/


To post comments you need to become a member. If you are already a member, please log in .

 



RELATED ARTICLES
ASP FilesystemObject
by Jeff Anderson
An introduction to the Filesystemobject
ASP GetTempName
by Jeff Anderson
Use the GetTempName method to create a randomly generated temporary file on the server.
ASP OpenTextFile
by Jeff Anderson
An introduction to the OpenTextFile Method of the FileSystemObject
ASP Format Date and Time Script
by Jeff Anderson
An ASP script showing the variety of date and time formats possible using the FormatDateTime Function.
Email validation using Regular Expression
by Jeff Anderson
Using regular expression syntax is an exellent way to thoroughly validate an email. It's possible in ASP.
ASP FileExists
by Jeff Anderson
An introduction to the FileExistsMethod of the FileSystemObject
Creating a Dynamic Reports using ASP and Excel
by Jeff Anderson
A simple way to generate Excel reports from a database using Excel.
Concatenate strings in sql
by Jeff Anderson
A brief introduction to concatenating strings in an sql query (using SQL server or access databases).
Add or Subtract Hours in SQL or ASP using DateAdd
by Jeff Anderson
A beginners guide to using the SQL DATEADD function to add or subtract hours. Particularly useful when setting the time displayed on the ASP page to a different time zone (eg when the server is in the US, and the site is for a UK audience).
ASP CreateTextFile
by Jeff Anderson
An explanation of the CreateTextFile Method, part of the ASP FileSystemObject








Recent Forum Threads
• Significant Factors
• Perl array access
• Re: huffman encoding and decoding in C++...
• Perl One Liner: Replace {(
• Re: html including php, accessing the functions
• Something like an INI editor or a DelimitedText-Editor
• Error Deleting File or Folder
• Re: How can use ASP.NET RegularExpressionValidator for alphanumeric 10 digit input
• Re: drop-down menu selected value


Recent Articles
ASP GetTempName
Decode and Encode UTF-8
ASP GetFile
ASP FolderExists
ASP FileExists
ASP OpenTextFile
ASP FilesystemObject
ASP CreateFolder
ASP CreateTextFile
Javascript Get Selected Text


© Copyright codetoad.com 2001-2009