?
Solved

Redirect to referrer page

Posted on 1998-09-01
7
Medium Priority
?
170 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
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 20 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This article will give core knowledge of JavaScript and will head in to your first JavaScript program. I am Durvesh Naik and I am here to deal with this series of JavaScript. I will teach you JavaScript in part wise , as its quite boring to read big…
This article discusses the difference between strict equality operator and equality operator in JavaScript. The Need: Because JavaScript performs an implicit type conversion when performing comparisons, we have to take this into account when wri…
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…
Suggested Courses

771 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