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

2

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.

html
forms
iis
post
http-status-code-405
asked on Stack Overflow Aug 24, 2011 by nroscoe • edited Aug 24, 2011 by ldiqual

2 Answers

1

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.

answered on Stack Overflow Aug 24, 2011 by Quentin
0

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.

answered on Stack Overflow Feb 8, 2017 by Gerard ONeill

User contributions licensed under CC BY-SA 3.0