Wednesday, March 13, 2013

Allowing DELETE Verb on .ashx file in IIS 7+

If you ever need to use the DELETE verb with an .ashx file on IIS 7 and above, you'll need to modify the SimpleHandlerFactory Handler Module either in IIS or in your web.config. I'll show you the code to add to your web.config below.

In your system.webServer node, simply add the following:

<handlers>
    <remove name="SimpleHandlerFactory-Integrated-4.0" />
    <add name="SimpleHandlerFactory-Integrated-4.0" path="*.ashx" verb="GET,HEAD,POST,DEBUG,DELETE" type="System.Web.UI.SimpleHandlerFactory" resourceType="Unspecified" requireAccess="Script" preCondition="integratedMode,runtimeVersionv4.0" />
</handlers>

I've seen other information suggesting disabling or removing a WebDAV handler, but it was not installed on my local IIS or on my production web server. The solution above worked for me.

Source: http://stackoverflow.com/a/10616736/256885

No comments:

Post a Comment