HTTP错误405.0 - 方法不允许 - POST失败 [英] HTTP Error 405.0 - Method Not Allowed -- POST Fails

查看:167
本文介绍了HTTP错误405.0 - 方法不允许 - POST失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个应该提交回自己的HTML网页,但如果method =POST,则会不断失败。它适用于GET,但我们真的想要POST。我删除了所有的代码,直到除了输入和提交之外什么都没有剩下,但总是得到了405错误。这个临时网页与我所能做到的一样简单。



我正在使用运行IIS 7的PC运行此测试。

 < form id =form1action =PhoneTest3.htmlmethod =POST> 
< label for =contactPhoneExt>联络电话:< / label>
< input id =contactPhoneExtname =contactPhoneExt/>
< br />

< input type =submitvalue =Submit/>
< / form>

我缺少什么?

解决方案

如果它确实是一个HTML页面(而不是隐藏在.HTML扩展名后面的脚本页面),那么您不能发布到它。



然而,您可以使用GET并通过Javascript可读取的命令行传递值。

编辑:更多详细信息。



GET 通过URL传递值。他们成为网址的一部分,可以添加书签,复制,修改等。



POST,另一方面,通过程序员调用 stdin来提供值。 stdin 文件一个程序读取并处理。可以通过这种方式传递大量数据,但需要在服务器上运行的程序能够访问任何数据 - 因此,无论本地文件接收发布数据必须都能够运行在服务器上。



它很混乱,因为Web服务器可以设置为显示一个 .html 扩展名他们的文件,但这些文件实际上是 PHP 运行的脚本。


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?

解决方案

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.

这篇关于HTTP错误405.0 - 方法不允许 - POST失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆