简体   繁体   中英

response redirect previous page classic asp

I want to go back one of several possible pages if the captcha was entered incorrectly on the referring page. This is what I am trying and it just bypasses the redirect when there is an error and takes them to the success page. If I put in response.redirect("somepage.asp") it works no problem but i need it to handle multiple page referers

Call ValidateCAPTCHA()
If m_CAPTCHAPASS<>1 then
Session("ValidCAPTCHA")="false"
Dim redirectpage
redirectpage = Request.ServerVariables("HTTP_REFERER") & "e=1" 
Session("FirstName")=Request.Form("First_Name")
Session("Phone")=Request.Form("Phone")
Session("EMail")=Request.Form("EMail")
Session("Comments")=Request.Form("Comments")
response.redirect(Request.redirectpage)
end if
'send email script follows

Following your comment, to prevent multiple parameter addition, just check if parameter already added. Something like:

Dim redirectpage

redirectpage = Request.ServerVariables("HTTP_REFERER") 
If Right(redirectpage, 4) <> "?e=1" Then redirectpage = redirectpage & "?e=1"
'.... the rest of the code

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM