p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   ASP.NET 2.0 Professional (http://p2p.wrox.com/forumdisplay.php?f=215)
-   -   redirect some pages automatically (http://p2p.wrox.com/showthread.php?t=59632)

Maxxim July 1st, 2007 06:37 PM

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!


planoie July 1st, 2007 10:35 PM

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

-Peter

Maxxim July 2nd, 2007 07:09 PM

really?

Is not possible do this with global.asax?

I have a lot of "old" pages :(


planoie July 2nd, 2007 09:09 PM

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

syedwaqarali July 3rd, 2007 12:45 AM

you are create pages dictionary and get server request then redirect


Maxxim July 3rd, 2007 06:10 PM

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


planoie July 3rd, 2007 07:46 PM

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

Maxxim July 4th, 2007 08:16 AM

ohhh OK!

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

Thanks a lot!

Problem solved!



All times are GMT -4. The time now is 08:50 AM.

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