Significance of URL Rewriting in ASP.NET

URL rewriting is the process of revamping URL structure of a page in a web site. This is probably one of the best ways to improve the usability, relevancy and search friendliness of the website.

URL Rewriting in ASP.NET

The Purpose of URL Rewriting
Consider in ASP.NET development when data-driven websites are created, web pages are developed which will display the subsets of data extracted from the database based on query string parameters. Let us consider an example to understand this. Consider you are developing an online shopping website and want to allow your users to browse through the products for various categories. Then for this you would require developing a page called displayCategory which will display the products to the user based on the specific category selected by him/her. To signify a specific category, a querystring parameter is used and hence, when a user selects a specific category to browse then URL something of below type is displayed for the page showing the category products.

Such kind of URLs are a mess and not easy to remember or reproduce. Actually according to the usability experts, idle URLs are those which can well meet the end user’s perspective. The good URLs are those which are short and easy to type. They should allow the user to easily browse through website and be able to give the user a better idea of the site structure. Hence, easy and memorable URL structures should be used. For example, consider the above URL, instead of using the querystring parameter here one can go for a simple and better approach with a value name, which means the URL should be something like

Apart from restructuring the pages, URL rewriting is a good approach to follow when you want to improve the search relevancy of the web pages in your website. This is because, with URL optimization by rewriting method, one can embed the common keywords easily understandable to user and the search engine into the URL. Hence, this increases the chances of someone clicking the link while will also improve the chances of your web page getting ranked better in SERPs.

Implementing URL Rewriting
In ASP.NET web development process, URL rewriting can be implemented with RewritePath() method of System.Web.HttpContext class is used. This class contains properties like request, response, application and session which help get access to incoming request and outgoing response and also the application and session variables. To implement URL rewriting, we need to create HTTP module or handler whose task is to check if the URL needs to be rewritten or not and if needed, then rewrite with RewritePath() method. This method accepts a single string parameter which is the new path to use. However, this RewritePath() can also be used in its overloaded form for the purpose.

So, URL rewriting is an important task which helps make website pages better understandable, accessible and search engine friendly. It is implemented as such in ASP.NET development process by the developers in order to make better ASP.NET websites.

1 Star2 Stars3 Stars4 Stars5 Stars (Average:5.00 , 1 Review )