Solved

Redirect to referrer page

Posted on 1998-09-01
7
165 Views
Last Modified: 2008-02-01
I am using a combination of javascript and Server side VBscript on an Active Server Page. Based on a session valiable, If false, I want to redirect to the page they came from.
Any Ideas?
0
Comment
Question by:dejthor
  • 2
  • 2
  • 2
  • +1
7 Comments
 

Expert Comment

by:matthewallum
ID: 1270044
try this _before_ any HTML code....

if the session varible is false (or whatever)

   Response.Redirect "newURL"


0
 
LVL 1

Author Comment

by:dejthor
ID: 1270045
Sure, I can redirect to a specific URL, However, i want to redirect them to the page they came from. That page is unknown.
0
 
LVL 8

Expert Comment

by:jbirk
ID: 1270046
In JavaScript you can always use history.go(-1) but I don't know anything about ASP...
-Josh
0
Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

 
LVL 28

Expert Comment

by:sybe
ID: 1270047
Use this before you write anything else in the ASP:
<%
If Not Session("whatever") Then
  Response.redirect(Request.ServerVariables("HTTP_REFERER"))
End If
%>
0
 
LVL 1

Author Comment

by:dejthor
ID: 1270048
That would work if I knew the url the user came from.
0
 
LVL 8

Expert Comment

by:jbirk
ID: 1270049
HTTP_REFERER is the url the user came from.
-Josh
0
 
LVL 28

Accepted Solution

by:
sybe earned 10 total points
ID: 1270050
dejthor,
I'll repeat my comment as my answer, because you say that it would work when you knew the url the user came from. The point is that you know it: Request.Servervariables("HTTP_REFERER") equals the url the user came from.

Try it, and you will see. If it does not work, then explain where is goes wrong, and someone might come up with a more satisfying answer.

Use this before you write anything else in the ASP:
<%
If Not Session("whatever") Then
   Response.redirect(Request.ServerVariables("HTTP_REFERER"))
End If
%>
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When you need to keep track of a simple list of numbers or strings, the Array object is your most direct tool.  As we saw in my earlier EE Article (http://www.experts-exchange.com/A_3488.html), typical array handling might look like this: (CODE) B…
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

803 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question