【问题标题】:The HTTP verb POST used to access path '/' is not allowed不允许使用用于访问路径“/”的 HTTP 动词 POST
【发布时间】:2011-04-27 23:45:20
【问题描述】:

整个错误:

Server Error in '/' Application.

The HTTP verb POST used to access path '/' is not allowed.
Description: An unhandled exception occurred during the execution of the current 
web request. Please review the stack trace for more information about the error 
and where it originated in the code.

Exception Details: System.Web.HttpException: The HTTP verb POST used to access
path '/' is not allowed.

Source Error:

An unhandled exception was generated during the execution of the current web 
request. Information regarding the origin and location of the exception can be
identified using the exception stack trace below.

Stack Trace:

[HttpException (0x80004005): The HTTP verb POST used to access path '/' is not allowed.]
System.Web.DefaultHttpHandler.BeginProcessRequest(HttpContext context, AsyncCallback callback, Object state) +2871966
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +8679410
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +155

说实话,我什至不确定错误来自哪里。我正在通过虚拟服务器运行 Visual Studio 2008。我只是放了一个按钮:

<asp:Button ID="btnRegister" runat="server" Text="Register" 
                            CssClass="bt_register" onclick="btnRegister_Click" />

在登录用户控件上,onclick 事件只是一个简单的 response.redirect

Response.Redirect("~/register.aspx");

调试项目,它甚至都没有点击 btnRegister_Click 方法。我不知道从哪里开始调试这个错误。任何信息都会有所帮助。我可以发布我拥有的所有代码,但就像我说的,我不确定这个错误是在哪里引发的。

编辑

它与按钮单击事件完全无关。我摆脱了aspx页面上的方法和onclick参数。仍然出现同样的错误

发现问题

好的,这是一个学校项目和一个小组项目。我小组中的一些人认为在这个区域周围包裹一个表单标签来告诉它发布是个好主意。发现它与 Google 代码的修订版存在差异。

【问题讨论】:

  • 我有同样的错误并修复它,如果你试图获取 html 文件的内容,请将其重命名为 aspx,因为它是不允许的

标签: asp.net


【解决方案1】:

你在重写 URL 吗? 好像是url重写有问题。

http://www.lukemelia.com/blog/archives/2007/01/05/aspnet-the-http-verb-post-used-to-access-path-is-not-allowed/

您必须在 IIS 设置中删除“*”到 aspnet_isapi.dll 的映射。

【讨论】:

  • 这是我的解决方案。同样的错误消息,由于在 WinXP Pro IIS 安装上设置 WinForms 应用程序之前安装了 MVC 2。
【解决方案2】:

虽然 Canvas URL 值必须以“/”结尾,但 Tabl URL 可以是完全限定页面(例如 http://[DOMAIN/DIRECTORY-PATH]/Default.aspx)。

我在本地工作,所以 http://localhost:4604/Main/Default.aspx 为我工作。

【讨论】:

  • 在尝试了很多差异解决方案之后,这个在使用 VS2010 服务器时对我有用。简单的。谢谢
猜你喜欢
  • 2011-07-11
  • 2011-06-04
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-12-21
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多