Response.Redirect错误

时间:2017-10-21 13:40:48

标签: asp.net asp.net-mvc asp.net-mvc-4 asp.net-mvc-3 asp.net-web-api

我有收集数据的表单页面。用户单击SUBMIT,进入“发布页面。此页面的末尾是我正在使用的重定向代码。     response.redirect( "test.asp?ChecklistID=" + ChecklistID ) 出于某种原因,结果就是这样。

  

/test.asp?ChecklistID=4784,%204784

为什么这会在TWO ID中返回?我在“结果”表中只有一条记录。这是'4784'。

添加代码

<%
'Option Explicit
Dim SQLStmt, sql, RS, ChecklistID, Location, ChecklistDate, Driveup, 
ConnectString, conn, objconn
Dim weeds, parking_lot, sidewalk, windows, exterior_trash, door_clean
Dim mats_clean, Notes_page1

Location = Request("Location")
ChecklistDate = Request("ChecklistDate")
Driveup = Request("Driveup")
ChecklistID = Request("ChecklistID")
weeds = Request("weeds")
parking_lot = Request("parking_lot")
sidewalk = Request("sidewalk")
windows = Request("windows")
exterior_trash = Request("exterior_trash")
door_clean = Request("door_clean")
mats_clean = Request("mats_clean")
Notes_page1 = Request("Notes_page1")

ConnectString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & 
Server.MapPath("../xyz/mydatabase.mdb")
Set conn = Server.CreateObject("ADODB.Connection")
conn.open ConnectString

SQLStmt = "SELECT * FROM Results WHERE ChecklistID =" & ChecklistID & " ; "

Set RS = Server.CreateObject("ADODB.Recordset") 

RS.open "Results", conn, 3, 3
RS.Update
RS("ChecklistDate") = ChecklistDate
RS("Driveup") = Driveup
RS("weeds") = weeds
RS("parking_lot") = parking_lot
RS("sidewalk") = sidewalk
RS("windows") = windows
RS("exterior_trash") = exterior_trash
RS("door_clean") = door_clean
RS("mats_clean") = mats_clean
RS("Notes_page1") = Notes_page1
RS.Update

RS.close
set RS = nothing
conn.close
set conn = nothing  

response.redirect( "test.asp?ChecklistID=" + ChecklistID )

%>

2 个答案:

答案 0 :(得分:0)

浏览器可能会使用response.redirect保留一些历史记录。尝试使用Server.Transfer。或者,如果它是同一页面,您可能不必重新添加查询字符串。

答案 1 :(得分:0)

解决 我在那里有两次相同的隐藏场导致了这个问题。