Link to home
Start Free TrialLog in
Avatar of Aleks
AleksFlag for United States of America

asked on

redirect to prev page

I am using ASP Classic.

I am currently using the script below on a page that has a stored procedure. It redirects to a specific page.

<script language="javascript">
window.location.href="Index.asp";
</script>

I need to tweak it so that it redirects to the PREVIOUS page.

Right now I have two pages that go to this one and because the redirect is fixed I need to pages to go back to the correct previous page.
Hope that makes sense.
ASKER CERTIFIED SOLUTION
Avatar of Ryan Chong
Ryan Chong
Flag of Singapore image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Aleks

ASKER

Second option worked perfectly, thanks !
If you are using a server side language, why would you use javascript?  If your are hitting your SP via a javascript ajax call, then using js to go back makes sense.  If your user is directed to a page (even if they don't "see" it) by your asp code, then you would probably be better off using response.redirect.

<%
set Conn = Server.createObject("ADODB.Connection")
Conn.open(my_connection_string)
set Cmd = Server.createObject("ADODB.Command")
set Cmd.activeConnection = Conn
Cmd.commandType = adCmdStoredProc
':
' stored proc code
':
set Cmd.activeConnection = nothing
set Cmd = nothing

Conn.close()
set Conn = nothing

' now redirect
response.redirect("my_new_page.asp")
%>

Open in new window

Avatar of Aleks

ASKER

Sorry forgot to click accept.