<a href='zf.asp?WBDzhuren="&WBDzhuren&"&ID="&rs4("ID")&"'class='zf'>转发</a>
-------------------------zf.asp的全部代码-----------------------
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>转发微博</title>
</head>
<body>
<!--#include file="odbc_connection.asp"-->
<%
dim WBDzhuren,ID,Zhuanfa
WBDzhuren=request.QueryString("WBDzhuren")
ID=request.QueryString("ID")
response.write ID & WBDzhuren
Dim strSql,strSql2 '首先要从利用URL中获得ID信息中检索出该微博记录
strSql="Select * From weibo where ID="&ID
Set rs=Server.CreateObject("ADODB.Recordset")
rs.Open strsql,conn1,1
if not rs.Bof then
Zhuanfa=rs("Zhuanfa")
strSql2="Update weibo Set Zhuanfa=" & Zhuanfa+1 & " Where ID=" & ID '将该微博的被转发数量+1
conn1.Execute(strSql2)
'以下将微博内容转发布到当前登陆账户
dim strSql3,Content
Content=WBDzhuren&":"& rs("Content")
strSql3="insert into weibo(Username,Content,Subtime,Zhuanfa,Pinglun,Ding,BplID) values('"&session("Strname")&"','"&Content&"',#"&Now()&"#,0,0,0,'N')"
conn1.Execute(strSql3)
else
end if
%>
</body>
</html>
很奇怪的是,从上一个页面点击转发,就会看到数据库中被插入了两条一模一样的记录,而刷新就会看到又插入了一条,代码就是按照一条来设计的,刷新是符合要求的。搞不懂是怎么回事,请大神指教哈
打开浏览器开发工具监测 转发的这个页面是否有别的请求操作。
用fiddler调试下,客户端是不是引发了2次请求。
ASP不懂
不过传说有个工具叫F12