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.

ldiqual
  • 15,015
  • 6
  • 52
  • 90
nroscoe
  • 93
  • 1
  • 7
  • This older answer might help you with your problem: http://stackoverflow.com/questions/4287330/iis-7-5-web-service-and-http-405-error – gislikonrad Aug 24 '11 at 18:15

2 Answers2

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.

Quentin
  • 914,110
  • 126
  • 1,211
  • 1,335
  • In IIS? No idea, try the manual? I'd expect it is a default because a plain HTML document can't process POST data, which makes making a POST request to one pretty pointless. Replacing the HTML document with a program (maybe an ASP.NET page) would seem to make more sense. – Quentin Aug 24 '11 at 18:01
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.

Gerard ONeill
  • 3,914
  • 39
  • 25