Sunday, May 11, 2008

Writing SEO friendly url using HttpHandlers in ASP.NET

In general it is recommend to not use querystring in the url as search engines doesn't rank those pages well and give very low priority. To avoid querystring there are several third party component that can be used like ISAPI, url rewriter. However in this article, I am going to show you how to rewrite url using ASP.NET built in HttpHandler.
 
Introduction

HttpHandler is the low level Request and Response API to service incoming Http requests. All handlers implement the IHttpHandler interface. There is no need to use any extra namespace to use it as it contains in the System.Web namespace. Handlers are somewhat analogous to Internet Server Application Programming Interface (ISAPI) extensions.

In this article, I am going to explain how to use HttpHandler to create a SEO friendly as well as user friendly url. During this article I will create two .aspx file, one HandlerUrl.cs class file. I am assuming here that I have to show different article based on the id I get from the request. But I will not get the id as querystring but as part of the name of the page like article1.aspx or article2.aspx. Here 1 and 2 is my article id. I will extract it and send into my page (showarticle.aspx) using Server.Transfer method so that my url in the browser will be like article1.aspx but internally it will be served as showarticle.aspx?id=1.
 

5 comments:

Sherry Beck said...

Your website is terribly informative and your articles are wonderful.

Greene said...

Targets can far more realistically be looking for tasks related to the quality of professional services, like connection and reporting discuss. Pay attention to these sorts of pledges. Do not be hesitant to press to improve recognize how an organization plans to always keep alone accountable with deliverables over a predetermined timetable.

Salk Jons said...

You create sense out of the foremost complex topics.
Buy niche edit links

Rocky said...

Hmm!! This blog is really cool, I’m so lucky that I have reached here and got this awesome information.
List Leverage

Amelia said...

I was getting bore since morning but as soon as I got this link & reached at this blog, I turned into fresh and also joyful too.
great site