built the WebDAV server

来源:百度文库 编辑:神马文学网 时间:2024/06/05 06:53:56
Kavitas,
I built the WebDAV server using a custom IHttpModule. As I described, it was mapped to handle all incoming requests. When you get a Request you will have access to the HttpApplication object that contains both the incoming HttpRequest object as well as an HttpResponse object.
The HttpRequest object gives you access to all of the HTTP Header information. That header information will contain the kind of WebDAV request you are getting (PROPFIND, PUT, MOVE, COPY, GET). Using that information along with other information in the header such as the Path, the Depth, and possibly the Destination you have to fulfill that response.
Basically there are a couple of different kinds of responses:
PROPFIND for example responds with an XML document defining the resources available at a given path. Some basic headers are set (app.Request.Headers.Add(”Content-Type”, “text/xml”)) and then the XML is written to the Request.Ouptut stream. COPY and MOVE don’t write a response to the output stream, but generally just set HTTP Response Codes. GET Requests are just like a regular HTTP GET. The person is requesting the contents of a file. In that case you set the Response status code, set the Content-Type, and then just stream the contents of the file to the Response.Output stream.
All of the specifics about the status codes and things are available atwww.webdav.org. The Response status codes are really important for protocol compliance.
Hope That Helps.