SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Wizard jag5311's Avatar
    Join Date
    Jan 2003
    Location
    Somewhere in Indiana
    Posts
    3,082
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    moving site from ASP to ASPX...need to forward URL's

    I have a site that is moving from ASP to ASPX. Is there a fairly easy way/method to make it so when a user visits lets say "employer.asp" that it will forward them off to "employer.aspx"?

    There are probably 25 pages total, so I am not sure if I can do this in a config file in .NET or if I have to modify some server module.

    Any help is greatly appreciated.

    Thanks
    Bryan

  2. #2
    SitePoint Wizard silver trophy
    Join Date
    Sep 2002
    Location
    Cleveland, Ohio, USA
    Posts
    1,494
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    First, you'll have to go into IIS and map .asp requests to ASP.NET. Look for the .aspx mapping, and copy the target, then paste that into the mapping for .asp.

    Next, your best bet is to use an HttpHandler. You map *.asp requests to the handler in web.config. Your actual class should implement IHttpHandler, and in the ProcessRequest method, do whatever processing magic you need to do. At that point, perform a 301 (permanent) redirect from the method to the new page. Your code looks something like this...

    context.Response.Status = "301 Moved Permanently";
    context.Response.StatusCode = 301;
    context.Response.AddHeader("Location","newpage.aspx");

    context is the HttpContext that is passed into the ProcessRequest method of the handler.

    If that's not enough to go on, feel free to ask more questions!

  3. #3
    SitePoint Zealot
    Join Date
    Mar 2005
    Posts
    162
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You should also be able to use a url rewrite module. But of course, thats not forwarding really. Its just rewriting.
    Web Application Development & Maintenance

  4. #4
    SitePoint Author silver trophybronze trophy
    wwb_99's Avatar
    Join Date
    May 2003
    Location
    Washington, DC
    Posts
    10,653
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    What Jeffy said. I actually have a "magic redirector" we have used for alot of these situations, and it really does magic--as in google getting the new URLs together in a weekend rather than over months. It has been a bit too good--alot of our backlinks have never been updated since the "magic" hides that issue effectively from other webmasters.

    I can't release the code, but the key trick was making a "mapping" XML schema to handle things.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •