不要用Cookie来传递验证值,要用会话变量Session来传递,安全性相对高。
<%
if request("validCode")<>session("validCode") then
response.write("<script>alert('验证码错误');history.go(-1);</script>")
response.end
end if
%>
你根本没在服务端进行验证,我刚才测试过了,把浏览器的安全级别设为最高(即不执行客户端脚本),任何内容都不填直接提交也可以留言的
我猜你在服务器进行验证是这样写的
<%
if request("validCode")<>cookie("validCode") then
response.write("<script>alert('验证码错误');window.location=history.go(-1);</script>")
end if
%>
这种方式吧
这样做是没有任何用处的,只要把客户端的脚本禁用照样提交,应该改成这种方式
<%
if request("validCode")<>cookie("validCode") then
response.write("<script>alert('验证码错误');</script>")
response.end '强行结束代码的运行,不让下面的代码继续执行
end if
%>