必须是行中的第一个语句 Redirect

来源:百度知道 编辑:UC知道 时间:2024/09/23 23:23:03
asp vbscript的问题 代码如下
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>登陆</title>
</head>

<body>
<%
if request.Form("txtlogin")<>"123456" or request.Form("txtpwd")<>"abcdef" then
response.Redirect "login_err.htm" End If
%>
<div align="center">
<p><font size="5">登陆信息</font></p>
<p>帐号:<%=request.form("txtlogin")%></p>
<p>密码:<%=request("txtpwd")%></p>
</div>

</body>
</html>

调试会出现 “必须是行中的第一个语句”的错误
在第11行 就是 response.Redirect "login_err.htm" End If 这里
高手帮忙解决一下

<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>

把这句删除就可以了

response.Redirect 必须在有网页内容输出之前使用
因为你前面输出了
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>登陆</title>
</head>

<body>
所以会出错