HTTP Error 405.0 - Method Not Allowed — POST Fails

空扰寡人 提交于 2019-12-11 02:56:07

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/12221692/http-error-405-0-method-not-allowed-post-fails

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!