用于访问路径“[我的路径]”中的HTTP动词POST是不允许的 [英] The HTTP verb POST used to access path '[my path]' is not allowed

查看:973
本文介绍了用于访问路径“[我的路径]”中的HTTP动词POST是不允许的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我收到了一条错误:用于访问路径的HTTP动词POST[我的路径]是不允许的

I am receiving an error that states: "The HTTP verb POST used to access path '[my path]' is not allowed.".

该错误可能出自我实现使用POST方法,并在其动作参数没有明确定义.aspx页面中的HTML表单元素造成的事实。

The error is being caused by the fact that I am implementing an HTML form element that uses the POST method and does not explicitly define an .aspx page in its ACTION parameter.

例如:

<form action="" method="post">
  <input type="submit" />
</form>

上面的HTML是一个文件在/foo/default.aspx。

The HTML above is on a file at "/foo/default.aspx".

现在,如果用户点URL到根目录下的富,而无需指定aspx文件(即HTTP://本地主机/ foo的),然后提交表单,错误使用的HTTP谓词POST访问路径'/富'是不允许的。将被抛出。

Now, if the user points the URL to the root directory "foo" without specifying the aspx file (i.e. "http://localhost/foo") and then submits the form, the error "The HTTP verb POST used to access path '/foo' is not allowed." will be thrown.

但是,如果用户进入的http://localhost/foo/default.aspx,然后提交表单时,一切顺利的话(即使操作参数为空)

However, if the user goes to "http://localhost/foo/default.aspx" and then submits the form, all goes well (even if the ACTION parameter is left empty).

请注意:如果我明确地添加在.aspx(Default.aspx的)页面的名称操作参数,没有错误抛出。因此,如果用户定义的文件的名称中的URL或不下面的例子中能正常工作而不考虑

Note: If I explicitly add the name of the .aspx (default.aspx) page to the ACTION parameter, no errors are thrown. So the example below works fine regardless if the user defines the name of the file in the URL or not.

<form action="default.aspx" method="post">
  <input type="submit" />
</form>

我很好奇,为什么被抛出的错误,所以我读了 Microsoft知识库各国

发生此问题,因为客户端
  通过发送发出HTTP请求
  POST方法一个静态的HTML页面。
  静态HTML页面不支持
  POST方法。

This problem occurs because a client makes an HTTP request by sending the POST method to a static HTML page. Static HTML pages do not support the POST method.

我想解释的核心是有道理的,但在我的情况,我的状态不会被发送到一个静态的html页面 - 它被发送到同一个页面的HTML表单住在(Default.aspx的)..这是隐含于为空的动作参数。

I suppose the core of the explanation makes sense, however in my case, my form is not being sent to a static html page - it's being sent to the same page that the html form lives on (default.aspx)... this is implicit to an ACTION param that is left empty.

是否可以配置IIS(或其他方式),让我们做的形式发布,并保持ACTION参数是空的?

Is it possible to configure IIS (or otherwise) that will allow us to do form POSTing and keep the ACTION param empty?

推荐答案

这是一个今年以来经历了最初这个错误,并认为我应该添加到这个职位,我不再收到错误。

It's been a year since initially experienced this error and thought I should add to this post that I am no longer receiving the error.

我不知道是什么固定的问题,但我的猜测是错误已消失,由于已经被我开发机器上的一年之内实施了一些Windows更新。

I don't know what fixed the problem, but my guess is that the error has gone away due to some Windows Update that has been implemented on my dev machine within the year.

一件事,我在IIS 7的设置注意的是,ISAPI.DLL(以下简称处理程序映射一节中)被禁用。我无法弄清楚如何使能,它以尝试重现该问题表明ISAPI.DLL造成(或相关)的问题。

One thing I noticed in the IIS 7 settings is that the "ISAPI.DLL" (in the "Handler Mappings" section) is disabled. I can't figure out how to "enable" it in order to try to reproduce the problem to show that the ISAPI.DLL is causing (or related) to the problem.

无论如何,我无法重现此错误发生时,我留在HTML表单标签动作属性空白。所以,我的猜测是,有一个IIS和/或.NET框架更新的或明或暗地修复了OP提到的错误。

Anyway, the I am unable to reproduce this error that occurs when I leave the "action" attribute blank in an HTML Form tag. So, my guess is that there is an IIS and/or .NET Framework update that implicitly or explicitly fixes the error mentioned in the OP.

这篇关于用于访问路径“[我的路径]”中的HTTP动词POST是不允许的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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