473,320 Members | 1,876 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Refering URL in a '404 Not found' page

Hello,

I know that I can get the refering URL using
Request.ServerVariables("HTTP_REFERER")

but how can I get the URL if the page no longer exists and so is being redirected to '404 File not found' page.

e.g.

this hypothetical link is no longer valid

http://www.abcd.com/HTML/030125.html

and I need it to automatically be redirected to

http://www.abcd.com/2003/030125.html

Thank you in anticipation,
Rajan
Jul 19 '05 #1
5 2677
Rajan Moorjaney wrote:
Hello,

I know that I can get the refering URL using
Request.ServerVariables("HTTP_REFERER")

but how can I get the URL if the page no longer exists and so is
being redirected to '404 File not found' page.

IIRC the requested page is sent in the query string to the 404 when using an
asp custom 404.
this hypothetical link is no longer valid
http://www.abcd.com/HTML/030125.html

and I need it to automatically be redirected to
http://www.abcd.com/2003/030125.html


Have you seen this? http://www.w3.org/Provider/Style/URI.html

--
William Tasso - http://WilliamTasso.com
Jul 19 '05 #2
Hi,

U could use the Status of the page, and if the status is 404, redirect to any other page, else display the page. The status is send along with the data for all the page anyone request, so thats would be a easy solution.

Regards,
Bhaskardeep Khaund
Jul 19 '05 #3
And if like myself, you don't have direct access to the server?

--

Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!

Disclaimer:
I know I'm probably wrong, I just like taking part ;o)
Bhaskardeep Khaund <bh*********@hotmail.com> wrote in message
news:ue**************@TK2MSFTNGP11.phx.gbl...
Hi,

U could use the Status of the page, and if the status is 404, redirect to
any other page, else display the page. The status is send along with the
data for all the page anyone request, so thats would be a easy solution.

Regards,
Bhaskardeep Khaund
Jul 19 '05 #4
How can I obtain the status of page?

Thank you.
"Bhaskardeep Khaund" <bh*********@hotmail.com> wrote in message news:ue**************@TK2MSFTNGP11.phx.gbl...
Hi,

U could use the Status of the page, and if the status is 404, redirect to any other page, else display the page. The status is send along with the data for all the page anyone request, so thats would be a easy solution.

Regards,
Bhaskardeep Khaund
Jul 19 '05 #5
Hi,

In your ASP Page, you can get the status by writing <% Response.Status %>. It would give u something like '200 OK'. SO, you would need to check for the status '404 Not Found'. Check out the site for more information:-

http://www.devguru.com/Technologies/...se_status.html
http://www.apl.jhu.edu/~hall/java/Se...atus-Line.html

Bhaskardeep Khaund
Jul 19 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

15
by: Taki Jeden | last post by:
Hello everybody Does anybody know why w3c validator can not get pages that use 404 htaccess redirection? I set up two web sites so that clients request non-existent urls, but htaccess redirects...
2
by: Nobody | last post by:
I am using C# ASPX and responding to the client with a page depending on what is in the query string. If the location in the query string is not found, I want to return the default 404 page. How...
2
by: Jonathan Folland | last post by:
I have been working on this most of the day and cannot find a solution to my problem. I have an application where I may not actually have a page. for example a user may make a request for...
7
by: Pat Carden | last post by:
I'm trying to provide a better user experience by redirecting my users to a "Page Not Found" page, using a Custom Errors directive in Web.Config. The problem is I need to return a 404 error code...
14
by: NormD | last post by:
We have a client-server app using Web Services on an IIS machine. The trace below shows that .NET is searching around for some things (e.g., SystemDrawing.DLL and System.Drawing.EXE) and taking a...
25
by: wd | last post by:
I want my server to send a 404 header if a URL with a query string is requested. So if a browser or spider requests something like www. my_site .com?p=chair they would get a 404... But if they...
1
by: Vlad | last post by:
Hello everybody, I have a problem with custom error page. I' using a redirection in a web.config file to a custom error page: <customErrors mode="RemoteOnly"...
0
by: nutso fasst | last post by:
Hello. IIS 4 website with a custom 404 error page WAS working OK, but at some point it wacked out. In the logs there were no 404 error responses. Instead, what were recorded were 200(OK)...
3
by: Yash | last post by:
Hi all, I found that while we are updating our application, the application is not known to tomcat, untill it is completed. So tomcat sends 503 page as resource not found. I want to know is...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.