当另一个 HTML 页面向其发送表单时,HTML 页面会抛出 405 错误
我有一个 html 页面,可以发布到另一个 html 页面。两个页面都加载良好,但是当我将第一页上的表单发布到第二页时,我收到 405 - 不允许方法错误。我使用 IIS 7 在 Windows 计算机上运行该网站。
这是发布到第二页的页面
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Form Post</title>
</head>
<body>
<form method="post" action="/test/form_fetch.html">
<input type="hidden" name="hidtest" value="works"/>
<input type="submit" value="submit" />
</form>
</body>
</html>
这是第二页
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Form Fetch</title>
</head>
<body>
</body>
</html>
错误详细信息:
HTTP 错误 405.0 - 不允许的方法
由于使用了无效方法(HTTP 动词),因此无法显示您正在查找的页面。
- 模块:StaticFileModule
- 通知:ExecuteRequestHandler
- 处理程序:StaticFile
- 错误代码:0x80070001
StaticFile 处理程序已设置为能够处理所有动词,但它仍然不起作用。
I have a html page that posts to another html page. Both pages load fine, but when I post the form on the first page to the second I get a 405 - Method Not Allowed error. I use IIS 7 to run the site on a windows machine.
This is the page that posts to the second page
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Form Post</title>
</head>
<body>
<form method="post" action="/test/form_fetch.html">
<input type="hidden" name="hidtest" value="works"/>
<input type="submit" value="submit" />
</form>
</body>
</html>
This is the second page
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Form Fetch</title>
</head>
<body>
</body>
</html>
Error details:
HTTP Error 405.0 - Method Not Allowed
The page you are looking for cannot be displayed because an invalid method (HTTP verb) is being used.
- Module: StaticFileModule
- Notification: ExecuteRequestHandler
- Handler: StaticFile
- Error Code: 0x80070001
The StaticFile Handler is already set to be able to deal with all verbs, but it still doesn't work.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这是服务器配置问题。文档中的任何内容都不会影响响应的 HTTP 状态代码。
服务器已设置为拒绝对该 URI 的 POST 请求。
This is a server configuration issue. Nothing in the document will affect the HTTP Status code of the response.
The server has been set to reject POST requests to that URI.
仅仅因为您不按动词过滤并不意味着处理程序可以处理动词。如何发布到静态文件?我敢打赌该错误来自处理程序本身。
相反,请尝试将该帖子发送到 CGI / ISAPI / MVC / WEBAPI / ASP / ASP.NET / PHP 页面。
Just because you don't filter by a verb doesn't mean that a handler can deal with a verb.. How do you post to a static file? I would bet that that error is coming from the handler itself.
Instead, try sending that post to a CGI / ISAPI / MVC / WEBAPI / ASP / ASP.NET / PHP page.