Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Professional
|
ASP.NET 2.0 Professional If you are an experienced ASP.NET programmer, this is the forum for your 2.0 questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Professional section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 1st, 2007, 06:37 PM
Friend of Wrox
 
Join Date: Mar 2006
Posts: 310
Thanks: 0
Thanked 0 Times in 0 Posts
Default redirect some pages automatically

hello!

i'm working on upgrade of my old webapplication.

I don't want to mantain the same structure...

I had pages like "www.mydomain.com/section/2/default.aspx" and i will substitute for: "www.mydomain.com/otherDir/default.aspx"

Many people have the old url on their "favorits" and i don't want to loose their visits!

I have more pages in this situation...

Can anyone tell me the best procedure redirect some pages on asp.net 2.0 ?

Thanks in advance!

 
Old July 1st, 2007, 10:35 PM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

The easiest would be to keep the old pages where they are, but change them to redirects to the new pages.

-Peter
 
Old July 2nd, 2007, 07:09 PM
Friend of Wrox
 
Join Date: Mar 2006
Posts: 310
Thanks: 0
Thanked 0 Times in 0 Posts
Default

really?

Is not possible do this with global.asax?

I have a lot of "old" pages :(

 
Old July 2nd, 2007, 09:09 PM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

Well, sure you can do this wherever you like with the right programming. Consider this:

If you remove x/y.aspx, IIS won't find it and will deliver a 404. However, if you set your application to have a custom 404 error page, then this custom page could check the URL that is being requested against some list. That list should have the old to new page mapping so you can then redirect the user to the new page. If there isn't a mapped page then you can deliver a true page not found error.

-Peter
 
Old July 3rd, 2007, 12:45 AM
Registered User
 
Join Date: Aug 2003
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to syedwaqarali Send a message via Yahoo to syedwaqarali
Default

you are create pages dictionary and get server request then redirect

 
Old July 3rd, 2007, 06:10 PM
Friend of Wrox
 
Join Date: Mar 2006
Posts: 310
Thanks: 0
Thanked 0 Times in 0 Posts
Default

yeeeees planoie! Thanks! I prefer that solution!

with that i only need one single page to redirect to the right content!

One more thing:

how can i retrieve the url request?

Because, if i have "personalPageNotFound.aspx" for my personal 404 error, when i run "requestURL" i retrieve "personalPageNotFound.aspx"...

How can i retrieve the url before the pagenotfound ?

I hope you understand my doubt..

Thanks

 
Old July 3rd, 2007, 07:46 PM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

On my site when I attempt a bad file I get redirected to this (and I'm pretty sure I didn't do anything special to get that to happen, just configured a custom 404 error page):

    error/err404.aspx?aspxerrorpath=/badfile.aspx

ASP.NET puts the bad url in the querystring. You can get it from there.

-Peter
 
Old July 4th, 2007, 08:16 AM
Friend of Wrox
 
Join Date: Mar 2006
Posts: 310
Thanks: 0
Thanked 0 Times in 0 Posts
Default

ohhh OK!

I didn't know that bad url came in querystring!

Thanks a lot!

Problem solved!






Similar Threads
Thread Thread Starter Forum Replies Last Post
Master Pages, Content Pages and CSS carliviris Visual Studio 2005 0 January 8th, 2008 05:56 PM
Redirect all pages of my web application Maxxim ASP.NET 1.0 and 1.1 Professional 16 May 23rd, 2007 11:05 AM
Transform Automatically DJAJ XSLT 0 March 10th, 2006 09:38 PM
Automatically change value abhisheksud Classic ASP Databases 0 December 13th, 2005 02:33 AM
Web pages constructing: I-mode(mobile) pages karib Dreamweaver (all versions) 3 June 6th, 2004 09:48 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.