HTTP Error 405.0 - Method Not Allowed -- POST Fails

I have an HTML web page that should submit back to itself, but constantly fails if method="POST". It works with GET, but we really want POST. I have ripped out all of the code until there is nothing left but an input and a submit, but it always gets the 405 error. This temp web page is as stripped down as I can make it.

I am running this test off my PC running IIS 7.

<form id="form1" action="PhoneTest3.html" method="POST">
    <label for="contactPhoneExt">Contact Phone: </label>
    <input id="contactPhoneExt" name="contactPhoneExt" />
    <br/>

    <input type="submit" value="Submit" />
</form>

What am I missing?

Upvotes: 3

Views: 10952

Answers (1)

Jeremy J Starcher
Jeremy J Starcher

Reputation: 23863

If it is truly an HTML page (and not a scripted page hidden behind an .HTML extension) then you can't post to it.

You can use GET and pass values through the command line that Javascript can read off, however.

EDIT: More details.

GET passes values through the URL. They become part of the URL and can be bookmarked, copied, easily modified, etc.

POST, on the other hand, feeds values through what programmers call stdin. stdin is like a file that a program reads and then processes. Much larger amounts of data may be passed this way, but it takes a program running on the server to be able to access any of that data -- thus, whatever local file receiving post data must be able to run on the server.

It gets confusing because web servers can be set up to show an .html extension on their files, yet those files are actually PHP scripts that run.

Upvotes: 5

Related Questions