有关request.querystring和get以及request.form与post的配对使用

shawls 2001-12-15 04:07:50
<!--include file="../comm/myconn.asp"-->
<%
if lcase(session("login"))<>"ok" and lcase(session("login"))<>"admin" then
Response.Redirect "/hngz9768/comm/error.asp?name=l"
Response.end
end if
dim gtext
dim gtop
'Response.Write Request.querystring("usertext")
'Response.Write Request.querystring("usertop") & "<br>"
gtext=Request.querystring("usertext")
'Response.Write gtext
gtop=Request.querystring("usertop")
'Response.Write gtop
gtext =Replace(gtext, chr(34), """)
gtext =Replace(gtext, chr(60), "<")
gtext =Replace(gtext, chr(62), ">")
gtext =Replace(gtext, chr(13), "<br>")
gtext =Replace(gtext, chr(32), " ")
gtop =Replace(gtop, chr(34), """)
gtop =Replace(gtop, chr(60), "<")
gtop =Replace(gtop, chr(62), ">")
gtop =Replace(gtop, chr(13), "<br>")
gtop =Replace(gtop, chr(32), " ")

if gtext="" or gtop="" then
set gtext=nothing
set gtop=nothing
Response.Redirect "/hngz9768/comm/error.asp?name=b"
Response.end
elseif len(gtop)>20 or len(gtext)>1000 then
set gtext=nothing
set gtop=nothing
Response.Redirect "/hngz9768/comm/error.asp?name=b"
Response.end
else
dim myrs
dim nowtime
nowtime=now
set myrs=server.createobject("ADODB.Recordset")
myrs.open "insert into [guestbook]([loginame],[logo],[txgtop],[gtext],[time]) values ('" & session("name") & "',' ','" & gtop & "','" & gtext & "','" & nowtime & "')",myconn,1,1
set myrs=nothing
set myconn=nothing
set nowtime=nothing
set gtext=nothing
set gtop=nothing
response.write gtext
response.write gtop
Response.Redirect "/hngz9768/comm/error.asp?name=a"
Response.end
end if
%>







gtext=Request.querystring("usertext")
gtop=Request.querystring("usertop")
这两个赋值语句同时使用的话

就会出现http 500 内部服务器错误

但是只是用 一个的话
就显示哪一个正常

而且
我用post提交,然后用request.form接受的话
也是同样的问题

求助

...全文
203 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
shawls 2001-12-20
  • 打赏
  • 举报
回复


谢谢,结了
shawls 2001-12-18
  • 打赏
  • 举报
回复


upok?
老土豆T 2001-12-16
  • 打赏
  • 举报
回复
如果有连接url=xxx.asp?userid=xxxxxx
Request.querystring("userid")
那就等到xxxxxx

如果前一个.asp程序中包含
<form action="xxx.asp" methed=post>
<input type=text name=username value="1234">
</form>
那么xxx.asp中的
request.form("username")
就得到了 上个页面里表单的内容1234。

如果怕混舀了,
那就只用request("username")
hchxxzx 2001-12-15
  • 打赏
  • 举报
回复
好象不可能出现这样的问题。
但现在既然出现了,理论上讲不通,只好去查一查到底出错在哪里。
建议你先来一个简单的,一个页面上只放两个TEXT,之后提交到另一页,分别用这两个变量取值,看还会不会出错?另外,用GET的时候,可以在地址栏上看一看,传递来的两个参数有没有变化?
我想实践是检验真理的唯一手段了。
元明 2001-12-15
  • 打赏
  • 举报
回复
当你的程序在第一次运行时
gtext
gtop
两个变量并未初始化
usertext,usertop两个变量里也许有错误,建议再加上判断他们合法性的语句.
netying 2001-12-15
  • 打赏
  • 举报
回复
usertext,usertop是什么,写出来看看,是不是哪写错了
shawls 2001-12-15
  • 打赏
  • 举报
回复


没有人回答吗?

28,391

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧