Ashx handler DELETE request does not work HTTP 405.0

I get HTTP error 405.0 - Method Not Allowed when I try to make a DELETE request to the .ashx handler from the download file of the jquery file that I was trying to implement.

Link to this question (http://stackoverflow.com/questions/6695587/enabling-put-on-iis-7-5-for-an-ashx-handler-using-windows-authentication) I added a section below to my file web.config, but the error may not seem to have disappeared. Are there any other tricks that I can't find to get DELETE to work?

I am using .Net 4.0 and IIS7.5 with the Windows azure emulator running.

<system.webServer> <modules> <remove name="WebDAVModule" /> </modules> <handlers accessPolicy="Read, Write, Execute, Script"> <remove name="WebDAV" /> <remove name="SimpleHandlerFactory-Integrated-4.0" /> <remove name="SimpleHandlerFactory-Integrated" /> <add name="SimpleHandlerFactory-Integrated" path="*.ashx" verb="GET,HEAD,POST,DEBUG,PUT,DELETE" type="System.Web.UI.SimpleHandlerFactory" resourceType="Unspecified" requireAccess="Write" preCondition="integratedMode" /> <add name="SimpleHandlerFactory-Integrated-4.0" path="*.ashx" verb="GET,HEAD,POST,DEBUG,PUT,DELETE" type="System.Web.UI.SimpleHandlerFactory" resourceType="Unspecified" requireAccess="Write" preCondition="integratedMode,runtimeVersionv4.0" /> </handlers> <security> <authorization> <remove users="*" roles="" verbs="" /> <add accessType="Allow" users="*" verbs="GET,HEAD,POST,PUT,DELETE,DEBUG" /> </authorization> </security> </system.webServer> 

And here is the front end code calling the handler:

 <td class="delete"> <button class="ui-button ui-widget ui-state-default ui-corner-all ui-button-icon-only" data-url="/webservices/FileTransferHandler.ashx?f=df69bfd1-2a15-43e3-9310-3ca163e2aeb2" data-type="DELETE" role="button" aria-disabled="false" title="Delete"> <span class="ui-button-icon-primary ui-icon ui-icon-trash"></span> <span class="ui-button-text">Delete</span> </button> </td> 

I have enabled tracking of failed requests and it is trying to use staticFileModule, while based on the .ashx request extension I think it will try to use SimpleHandlerFactory.

Here's the link I'm clicking on: http://local.testsite.com:80/webservices/FileTransferHandler.ashx?f=df69bf1-2a15-43e3-9310-3ca163e2aeb2

Why will this link use staticFileModule, not for images or documents like .jpg and .pdf?

+4
source share
2 answers

Here is the final section of web.config. What I needed to add, I was absent, is the change of staticFileHandler from using "all verbs" for all of them.

 <system.webServer> <modules> <remove name="WebDAVModule" /> </modules> <handlers accessPolicy="Read, Write, Execute, Script"> <remove name="StaticFile" /> <remove name="SimpleHandlerFactory-ISAPI-2.0" /> <remove name="WebDAV" /> <remove name="SimpleHandlerFactory-Integrated-4.0" /> <remove name="SimpleHandlerFactory-Integrated" /> <add name="SimpleHandlerFactory-Integrated" path="*.ashx" verb="GET,HEAD,POST,DEBUG,PUT,DELETE" type="System.Web.UI.SimpleHandlerFactory" resourceType="Unspecified" requireAccess="Write" preCondition="integratedMode" /> <add name="SimpleHandlerFactory-Integrated-4.0" path="*.ashx" verb="GET,HEAD,POST,DEBUG,PUT,DELETE" type="System.Web.UI.SimpleHandlerFactory" resourceType="Unspecified" requireAccess="Write" preCondition="integratedMode,runtimeVersionv4.0" /> <add name="SimpleHandlerFactory-ISAPI-2.0" path="*.ashx" verb="GET,HEAD,POST,DEBUG,PUT,DELETE" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll" resourceType="Unspecified" requireAccess="Script" preCondition="classicMode,runtimeVersionv2.0,bitness32" responseBufferLimit="0" /> <add name="StaticFile" path="*" verb="GET,HEAD,POST,DEBUG,PUT,DELETE" modules="StaticFileModule,DefaultDocumentModule,DirectoryListingModule" resourceType="Either" requireAccess="Read" /> </handlers> <security> <authorization> <remove users="*" roles="" verbs="" /> <add accessType="Allow" users="*" verbs="GET,HEAD,POST,PUT,DELETE,DEBUG" /> </authorization> </security> <tracing> <traceFailedRequests> <remove path="*" /> <add path="*"> <traceAreas> <add provider="ASP" verbosity="Verbose" /> <add provider="ASPNET" areas="Infrastructure,Module,Page,AppServices" verbosity="Verbose" /> <add provider="ISAPI Extension" verbosity="Verbose" /> <add provider="WWW Server" areas="Authentication,Security,Filter,StaticFile,CGI,Compression,Cache,RequestNotifications,Module,FastCGI" verbosity="Verbose" /> </traceAreas> <failureDefinitions statusCodes="405" /> </add> </traceFailedRequests> </tracing> </system.webServer> 
+11
source

If you use PHP inside an IIS server, follow these steps: I solved the problems by adding verb removal for the PHP module. 1. Open IIS. 2. Go to the configuration editor. 3.Form Section DropDown Select System.WebServer. 4.Select a handler, it will show you the available click on the handler next to
count to open handlers. 5.Goto PHP_viaFastCGI and Add Delete as a verb next to POST.

0
source

All Articles