Solved

How to set a response redirect to go back one page

Posted on 2007-11-28
5
824 Views
Last Modified: 2009-07-29
Hi

I have a form which has a response redirect at the end. I'd like this to go back one page (ie the page before the form page) can I do this with javascript?

Thanks

The code of the form is

if (Request.Form("Submit")) = "Submit" then

		emailmsg = ""

		for each thing in request.form

			emailmsg = emailmsg & trim(thing) & ": " & trim(request.form(thing)) & vbcrlf 

		next	

		set msg = Server.CreateOBject( "JMail.Message" )

		msg.Logging = true

		msg.silent = false

		msg.From = request.form("email")		

		msg.AddRecipient "sales@"			'Recipient of emailed form

		msg.Subject = "Stock enquiry"					'Subject of Email

		msg.Body = cstr(EmailMsg)

		msg.Send( "" ) 			'Change this to www2, www3 etc

		response.redirect "thank_you_mail.asp"				'address of thank you page

	end if

Open in new window

0
Comment
Question by:swordfishsoup
  • 3
5 Comments
 
LVL 82

Expert Comment

by:hielo
ID: 20365989
You can send this javascript snippet to the client:
<script type="text/javascript">
top.location.href= "http://www.yourdomain.com/yourpageBeforetheForm.asp?x=1&y=2";
</script>

where x and y are "variables" you may wish to pass onto the page before the form.
0
 
LVL 30

Expert Comment

by:third
ID: 20366051
my advice is to put the referrer on a hidden form field. then use this to redirect to your previous page.
0
 
LVL 30

Accepted Solution

by:
third earned 500 total points
ID: 20366073
hmm, the code snippet portion is new. ok here,

 

<input type="hidden" name="redirPage" value="<%=Request.ServerVariables("http_referer")%>">
 
 
 

then on your page
 

response.redirect Request("redirPage")

Open in new window

0
 

Author Comment

by:swordfishsoup
ID: 20366157
Fantastic, works a treat.

Thanks very much 'third'

Dave
0
 
LVL 30

Expert Comment

by:third
ID: 20366182
welcome. ;-)
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

In Part 1 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7849-Hex-Maze.html) we covered the hexagonal maze basics -- how the cells are represented in a JavaScript array and how the maze is displayed.  In this part, we'…
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
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…

929 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now