Wrox Programmer Forums
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics 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 June 11th, 2003, 11:30 AM
Authorized User
Join Date: Jun 2003
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
Default Response.Redirect

If I use the Response.Redirect on the previous page (24ProcAddEdit.asp), the following code will not work as intended.
The third choice (Else) will happen promting the question "where did you come from".
It appears that -Request.ServerVariables("HTTP_REFERER")- does not see what the previous page was. How do I fix this?
If I remove the Response.Redirect from the previous page and use a link to manualy get to this page it works fine

If InStr(Request.ServerVariables("HTTP_REFERER"), "24ProcAddEdit.asp") Then
     strQSMEID = Session("sv24MEID")
     Response.Write "You came from 24"
 ElseIf InStr(Request.ServerVariables("HTTP_REFERER"), "20AddNewME.asp") Then
      strQSMEID =Request.QueryString ("MEID")
      Response.Write "You came from 20"
            Response.Write "Where did you come from?"
End If
Old June 11th, 2003, 12:17 PM
Friend of Wrox
Join Date: Jun 2003
Posts: 158
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to NotNowJohn

Response.Redirect just reroute your browser request. In other words you don't receive 200 response code from the page contains only Response.Redirect statement.
So, ServerVariables("HTTP_REFERER") will contains the address (if exists) from which you arrived to 24ProcAddEdit.asp.


...but the Soon is eclipsed by the Moon
Old June 11th, 2003, 01:05 PM
Authorized User
Join Date: Jun 2003
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts

Is there an alternative to Response.Redirect?

Old June 11th, 2003, 01:12 PM
Imar's Avatar
Wrox Author
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts

Yes, there is. On the server you can use Server.Transfer, which skips the step of informing the client browser.

You can also use Response.Write to push some JavaScript to the client, using location.href to force the browser to request a new page (you can pass in the old URL so in the user's experience he "goes back" while in reality (history-wise) he'' go forward).


Old June 16th, 2003, 05:56 AM
Registered User
Join Date: Jun 2003
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts

I also used javascript to jump to other pages. It's much more easier. Try it.

Similar Threads
Thread Thread Starter Forum Replies Last Post
Response.Redirect in c# class. manish.sharma04 BOOK: Professional ASP.NET 2.0 and Special Edition; ISBN: 978-0-7645-7610-2; ISBN: 978-0-470-04178-9 17 February 28th, 2012 07:01 PM
response.redirect sarah lee ASP.NET 1.0 and 1.1 Basics 1 October 27th, 2006 08:57 AM
response.redirect ava_h .NET Framework 2.0 0 October 18th, 2006 10:21 PM
response.redirect crmpicco Classic ASP Basics 3 February 9th, 2005 01:50 AM
Using response.redirect wi shs BOOK: Beginning ASP.NET 1.0 3 April 2nd, 2004 09:54 AM

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