原来做过的一个用户登录的页面,取的是非默认首页名称,一直运行的很好,最近有项目中将文件名更新为默认首页名称,结果发现在提交表单后页面重定向时发生HTTP 405 - 资源被禁止错误,经过检查,发现是form没有指定action,只怪自己当时偷懒,想着不指定action的话不管文件名怎么取都不需要去重新设置,结果却遇到这个错误!测试用例: 正确代码: <form method="post" action="index.asp"> <input type="text" name="a"> </form> <% If request("a") = "test" then response.redirect "index.asp" end if %>错误代码: <form method="post"> <input type="text" name="a"> </form> <% If request("a") = "test" then response.redirect "index.asp" end if %>
正确代码:
<form method="post" action="index.asp">
<input type="text" name="a">
</form>
<%
If request("a") = "test" then
response.redirect "index.asp"
end if
%>错误代码:
<form method="post">
<input type="text" name="a">
</form>
<%
If request("a") = "test" then
response.redirect "index.asp"
end if
%>