Click here to Skip to main content
15,886,075 members
Articles / Web Development / IIS

URL Rewriting using ASP.NET for SEO

Rate me:
Please Sign up or sign in to vote.
4.73/5 (25 votes)
25 Feb 2009CPOL15 min read 164.7K   6.8K   130  
An article describing how to implement URL rewriting in ASP.NET using three different methods
using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class UnfriendlyPage : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if(!IsPostBack)
        {
            lblDetails.Text = "<h1>Hello from UnfriendlyPage.aspx!</h1><br/><br/>";

        }
        else
        {
            lblDetails.Text = "<h1>Post-back to UnfriendlyPage.aspx!</h1><br/><br/>";

        }


        foreach (string Query in Request.QueryString.Keys)
        {
            lblDetails.Text += "PARAMETER: " + Query + "=" + Request.QueryString[Query] + "<br/>";
        }

        lblDetails.Text += "<br/><br/>Request URL: " + Request.RawUrl;
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Technical Lead Hidalgo Limited
United Kingdom United Kingdom
Steve is an MCP and senior software developer for Hidalgo Limited (http://www.hidalgo.co.uk).

Comments and Discussions