In this article we will learn how to use URL rewriting to map URLs for better search results and user friendly URLs. This comes in handy when we are working with query strings, but don’t actually want to display the query string values to the user. For instance, we could turn the URL ‘~/Default.aspx?page=Books’ into ‘~/Books’.
First, we will need to create a new ASP.NET Empty Web Site and add a new page to it named ‘Default.aspx’. For this example we will be rewriting two URL’s, a ‘Books’ page and an ‘Magazine’ page.
Let’s build our page with links to those pages. To begin, open Default.aspx and:
- Add a hyperlink control ans set the text property to Books.
- Set the NavigateUrl property to ‘~/Books
- Add a second hyperlink control and set the text property to Magazine.
- Set the NavigateUrl property to ‘~/Magazine’.
Now we have two different links that we … More