Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Professional
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old July 1st, 2007, 06:37 PM
Friend of Wrox
 
Join Date: Mar 2006
Location: , , Portugal.
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!

  #2 (permalink)  
Old July 1st, 2007, 10:35 PM
planoie's Avatar
Friend of Wrox
Points: 16,481, Level: 55
Points: 16,481, Level: 55 Points: 16,481, Level: 55 Points: 16,481, Level: 55
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2003
Location: Clifton Park, New York, USA.
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
  #3 (permalink)  
Old July 2nd, 2007, 07:09 PM
Friend of Wrox
 
Join Date: Mar 2006
Location: , , Portugal.
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 :(

  #4 (permalink)  
Old July 2nd, 2007, 09:09 PM
planoie's Avatar
Friend of Wrox
Points: 16,481, Level: 55
Points: 16,481, Level: 55 Points: 16,481, Level: 55 Points: 16,481, Level: 55
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2003
Location: Clifton Park, New York, USA.
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
  #5 (permalink)  
Old July 3rd, 2007, 12:45 AM
Registered User
 
Join Date: Aug 2003
Location: karachi, sn, Pakistan.
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

  #6 (permalink)  
Old July 3rd, 2007, 06:10 PM
Friend of Wrox
 
Join Date: Mar 2006
Location: , , Portugal.
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

  #7 (permalink)  
Old July 3rd, 2007, 07:46 PM
planoie's Avatar
Friend of Wrox
Points: 16,481, Level: 55
Points: 16,481, Level: 55 Points: 16,481, Level: 55 Points: 16,481, Level: 55
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2003
Location: Clifton Park, New York, USA.
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
  #8 (permalink)  
Old July 4th, 2007, 08:16 AM
Friend of Wrox
 
Join Date: Mar 2006
Location: , , Portugal.
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!

 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 12:35 PM.


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