为什么这段程序redirect不了?

huang_2 2001-11-26 07:14:52
这是关键的那段程序,就是then那里出问题
<%
q1=request("q1")
q2=request("q2")
if q1="" or q2="" then
response.redirext "login.asp"
end if
%>

它显示
Microsoft VBScript 运行时错误 错误 '800a01b6'

对象不支持此属性或方法: 'redirext'

/practice/TMP7xsimnhf59.asp, 行21
...全文
124 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
希偌 2001-11-28
  • 打赏
  • 举报
回复
非常简单的
正如错误信息所说的——
“HTTP 标题已经写入到 客户浏览器。任何 HTTP 标题的修改必须在写入页内容之前。 ”
你应该把
<%
q1=request("q1")
q2=request("q2")
if q1="" or q2="" then
response.redirect "login.asp"
end if
%>
写到<html>前
至于其他的,你可以用response.write在<html>前实现
crodling 2001-11-28
  • 打赏
  • 举报
回复
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<%
q1=request("q1")
q2=request("q2")
if q1="" or q2="" then
response.redirect "login.asp"
end if
%>
<body bgcolor="#FFFFFF" text="#000000">
<form name="form1" method="post" action="">
<input type="radio" name="q1" value="radiobutton">
<input type="radio" name="q2" value="radiobutton">
</form>
</body>
</html>

换个位置
blackant2 2001-11-27
  • 打赏
  • 举报
回复
好的办法是先写完了你这段asp再写html
kuzi 2001-11-27
  • 打赏
  • 举报
回复
我同意后面几位的!
flyingghost 2001-11-27
  • 打赏
  • 举报
回复
asp页面在redirect之前不能写任何http头到浏览器,redirect应该在超文本标签和response.write前面。如果想实现你的功能,在文件一开始声明response.buffer=true使用服务端页面缓存。这样在response.end或response.flush或页面结束之前不会输出至浏览器。
julyclyde 2001-11-26
  • 打赏
  • 举报
回复
你已经把<html>什么的输出到浏览器了,所以不能REDIRECT
在页面最最前边加<%resopnse.buffer=true%>即可
sichuanwww 2001-11-26
  • 打赏
  • 举报
回复
form里怎么没提交?
huang_2 2001-11-26
  • 打赏
  • 举报
回复
那只是我一时写错了,在程序中我没写错,下面是我的完整代码,上面的那些不用看了

<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>

<body bgcolor="#FFFFFF" text="#000000">
<form name="form1" method="post" action="">
<input type="radio" name="q1" value="radiobutton">
<input type="radio" name="q2" value="radiobutton">
</form>
<%
q1=request("q1")
q2=request("q2")
if q1="" or q2="" then
response.redirect "login.asp"
end if
%>
</body>
</html>

显示错误信息如下:

响应对象 错误 'ASP 0156 : 80004005'

标题错

/practice/TMP96a7nhjm0.asp, 行16

HTTP 标题已经写入到 客户浏览器。任何 HTTP 标题的修改必须在写入页内容之前。






crodling 2001-11-26
  • 打赏
  • 举报
回复
是'redirect'而不是'redirext'

28,406

社区成员

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

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