开发者

HTML page throws a 405 error when another HTML page posts a form to it

开发者 https://www.devze.com 2023-03-30 17:41 出处:网络
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

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.


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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消