Search code examples
asp.net-mvcwebdavcaldavcustom-headers

Custom headers ASP.net MVC


I'm trying to serve WebDav requests to create a CalDav server so that users can access our calendar function easily on any device of their choosing.

The problem is in trying to serve any custom headers. I've written a custom ActionResult that sets up any result easily in the right way. Upon a OPTIONS request, which gets recognized, it adds:

response.AppendHeader("Allow", "OPTIONS, PROPFIND, HEAD, GET, REPORT, PROPPATCH, PUT, DELETE, POST");

When I look into the request that the end-user receives the following header appears:

Allow: OPTIONS, TRACE, GET, HEAD, POST

When I then try to do a request with the custom header PROPFIND it simply returns a 404 error. I tried googling but there is not a lot around about this stuff. It's probably something I have to enable or disable.


Solution

  • I had to remove the WebDavModule and WebDav handler in the web config. After I had done that it worked perfectly.

    <system.webServer>
      <modules runAllManagedModulesForAllRequests="true">
        <remove name="WebDAVModule" />
      </modules>
      <handlers>
        <remove name="WebDAV" />
      </handlers>
    </system.webServer>