ASP重定向响应

时间:2011-05-05 21:39:47

标签: asp-classic http-redirect

在代码中我将放置response.redirect()代码,以便在用户选择提交按钮发送数据后执行它?我的目标是在提交到感谢页面后重定向用户。

<!--#include file="db.asp" -->
<%
dim sql, intmid, strnameFirst, strnameMiddle, strnameLast, straddHome, strcityHome, strstateHome, strzipHome, strphoneHome, strfaxHome, stremailHome, strclassYear, stremployment, straddEmploy, straddEmploy2, strcityEmploy, strstateEmploy, strzipEmploy, strnumberEmploy, strfaxEmploy, stremailEmploy, strpositionEmploy, strmailPref, strexpertise, strserveBoard, strExplain, strextraInfo
dim str1, str2, str3, str4, str5, str6, str7, str8, str9, str10, str11, str12, str13, str14, str15, str16, str17, str18, str19, str20, str21, str22, str23, str24
intmid = cint(request("memb_id")) 

if intmid <> "" and intmid <> "0" then
sql = "select * from members_table where memb_id=" & intmid
set rs = con.execute(sql)

strnameFirst        =   rs("memb_first_name")
strnameMiddle       =   rs("memb_mid_name")
strnameLast         =   rs("memb_last_name")
straddHome          =   rs("memb_home_add")
strcityHome         =   rs("memb_home_city")
strstateHome        =   rs("memb_home_state")
strzipHome          =   rs("memb_home_zip")
strphoneHome        =   rs("memb_home_phone")
strfaxHome          =   rs("memb_home_fax")
stremailHome        =   rs("memb_home_email")
strclassYear        =   rs("memb_grad_class")
stremployment       =   rs("memb_emp_plcae")
straddEmploy        =   rs("memb_emp_add")
straddEmploy2       =   rs("memb_emp_add2")
strcityEmploy       =   rs("memb_emp_city")
strstateEmploy      =   rs("memb_emp_state")
strzipEmploy        =   rs("memb_emp_zip")
strnumberEmploy     =   rs("memb_work_phone")
strfaxEmploy        =   rs("memb_work_fax")
stremailEmploy      =   rs("memb_work_email")
strpositionEmploy   =   rs("memb_position")
strmailPref         =   rs("memb_mail_pref")
strexpertise        =   rs("memb_area_expert")
strserveBoard       =   rs("memb_willing")
strExplain          =   rs("memb_area_other")
strextraInfo        =   rs("memb_add_info")


strexpertise = split(strexpertise,",")
for i = lbound(strexpertise) to ubound(strexpertise)
If strcomp(strexpertise(i),"Arts_and_Culture",1) = 0 Then
str1 = "checked"
End if
if strcomp(strexpertise(i),"Business",1) = 0 Then
str2= "checked"
End If
if strcomp(strexpertise(i),"Communications",1) = 0 Then
str3= "checked"
End If
if strcomp(strexpertise(i),"Education",1) = 0 Then
str4= "checked"
End If
if strcomp(strexpertise(i),"Government_Agency",1) = 0 Then
str5= "checked"
end If
if strcomp(strexpertise(i),"Health",1) = 0 Then
str6= "checked"
end if
if strcomp(strexpertise(i),"Human_Services",1) = 0 Then
str7= "checked"
end If
if strcomp(strexpertise(i),"Law",1) = 0 Then
str8= "checked"
end If 
if strcomp(strexpertise(i),"Non_Profit",1) = 0 Then
str9= "checked"
end if
if strcomp(strexpertise(i),"Profit",1) = 0 Then
str10= "checked"
end If
if strcomp(strexpertise(i),"Other",1) = 0 Then
str11= "checked"
end If
if strcomp(strexpertise(i),"Administration",1) = 0 Then
str12= "checked"
end If
if strcomp(strexpertise(i),"Banking",1) = 0 Then
str13= "checked"
end If
if strcomp(strexpertise(i),"Computers",1) = 0 Then
str14= "checked"
end If
if strcomp(strexpertise(i),"Finance",1) = 0 Then
str15= "checked"
end If
if strcomp(strexpertise(i),"Fundraising",1) = 0 Then
str16= "checked"
end If
if strcomp(strexpertise(i),"Grantwriting",1) = 0 Then
str17= "checked"
end If
if strcomp(strexpertise(i),"Management",1) = 0 Then
str18= "checked"
end If
if strcomp(strexpertise(i),"Marketing",1) = 0 Then
str19= "checked"
end if
if strcomp(strexpertise(i),"Program_Development",1) = 0 Then
str20= "checked"
end If
if strcomp(strexpertise(i),"Planning",1) = 0 Then
str21= "checked"
end If
if strcomp(strexpertise(i),"Public_Relations",1) = 0 Then
str22= "checked"
end If
if strcomp(strexpertise(i),"Policy_and_Procedurese",1) = 0 Then
str23= "checked"

end if
next

rs.close
set rs = nothing

end if


%>

1 个答案:

答案 0 :(得分:0)

我的经验中的传统用法是:

  1. 表单页面 - 收集元素,提交表单,用户看到
  2. 处理页面捕获元素,做一些谎言数据库插入,重定向到“谢谢”类型页面,用户不会看到
  3. 感谢您的页面,通过处理中的元素进行最佳个性化
  4. 所以答案是将重定向放在接受和处理表单输入的任何页面上。