Redirect old aspx to new MVC

I upgraded Dvdcrate.com to be ASP.NET MVC and one of the problem is the old pages are indexed by search engines and being served on search results. So I have the old *.aspx page that I need to fix up and send along to the MVC page.

An example of the page in the search database;
www.dvdcrate.com/viewdvd.aspx?upc=5027035006161

And I need it to go to the new MVC controller and action like this;
www.dvdcrate.com/Media/Detail/5027035006161

So I did it this way, I put this in the Global.aspx.cs file;

Probably not the most elegant, but it does work.

Enjoy!

Comments

comments

3 thoughts on “Redirect old aspx to new MVC”

  1. Is there any reason why you didnt do:

    if (Request.Path.Contains(“/viewdvd.aspx”)) {
    Response.Redirect(“/Media/Detail/” + Request.QueryString[“upc”]);
    }

Leave a Reply