jQuery POST, Error 405 Method not allowed

这一生的挚爱 提交于 2019-11-27 01:59:27

A 405 is thrown by IIS when an HTTP verb(GET,PUT,POST,DELETE,HEAD,etc.) is requested and is not supported/disallowed by the designated handler.

You'll need to open the IIS manager -> Default Web Site -> Handler Mappings (Or the handler mappings specific to your web-application)

In here you'll need to play with the handler mappings as one of them is not allowing "POST" verbs.

As you are not posting to any specific page (.aspx, .ashx, etc.), it will be difficult to identify the exact handler that is causing you issues.

Handlers of interest may be:

  • ExtensionlessUrlHandler-ISAPI-4.0_32bit /64bit
  • StaticFile

Once you identify the handler your request is being routed to, double click it to open the dialogue.

From there click "Request Restrictions" then "Verbs"

Make sure the appropriate verb is present in the text area.

As I mentioned before, I'm not sure which handler is handling your request as you are not posting to any particular page (you may have URL re-writing in place that is routing your request appropriately).


If the above fails, you may need to check if WebDAV Publishing is installed and remove it (restart required).

user3363118

Maybe you should modify your post'URl format like this:

$.post('@Url.Content("~/Attach/UpdateAttach")'

some users here are having shared hosting and not dedicated servers, so they might not be able to get access to the IIS control panel..

this is my case and here is what I found..

I have my web application on the root directory created through Godaddy control panel.. and the POST request is acknowledged ..

then I used the FileZilla to create a testing folder for my jquery ..( notice i used FileZilla , so the web application and hence the IIS of GoDaddy is not aware that I wanted this folder to be part of my we application )

then whenever I test this jQuery on this testing folder.. I get that error [405 Method not allowed]..

the solution was extremely simple :

I moved my testing page out of that testing folder created by FileZilla and located it inside a folder that was created through Godaddy control panel ( in this case the IIS will be aware that this page is part of my web application :) )

Hope that will help those on Shared hosting

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