Httphandler for WebDav requests
Asked Answered
T

0

2

I am trying to write a asp.net httphandler for handling webdav requests with IIS.

I am extending the IHttpHandler interface and implementing the ProcessRequest.

public class clsMyHandler  : IHttpHandler
{
    public void ProcessRequest(System.Web.HttpContext context)
    {
        StreamWriter sw = new StreamWriter(@"C:\requestLog.txt",true);
        sw.WriteLine("Got a request at " + DateTime.Now.ToString());
        sw.Close();
    }
    public bool IsReusable
    {
        get
        {
            return true;
        }
    } 
}

It's a simple handler for my test purpose to just log into a file when I get the webdav request for a file of given name. I can see the handler listed in the Handler mappings.

This is the web.config

    <handlers>
        <add name="testhandler" verb="*" path="*e.txt" type="MyPipeLine.clsMyHandler, MyPipeLine" />
    </handlers>

It works fine when the request is a http from browser. My handler gets executed and logs in the file. But when the request is webdav(I have enabled webdav with IIS and mapped the website root as a network drive) editing a file of the pattern *e.txt fails which I would expect as I am overriding the webdav handler, but I do not see it getting logged in my file.

I am not sure if there is a server log that I can check to get some clue as to whether or not the handler was invoked and if there is an error in the handler. I am new to this.

I am not finding much materials/guides online regarding httphandlers for webdav.

Appreciate any help.

Tjader answered 23/12, 2014 at 18:2 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.