Implement a WebDAV server in C#?
We've got a CMS system written in .NET C#. This system has editing facilities for templates (essentially HTML files) and various other support files such as CSS and javascript files.
These "files" are not really files, but database records and they are edited using plain old textareas within the CMS system.
To make editing these "files" easier, one idea was to implement WebDAV support in the CMS system for these files, so users could use some WebDAV client software to connect to the CMS and then open these in VS 2008 for example.
Firstly, is this a feasible idea?
Secondly, if so ... where to start? Any good art开发者_如何学编程icles out there about implementing a WebDAV server in C# to provide access to either physical documents or "pseudo" documents which are in reality just records in a database?
Any input appreciated ....
One route to go is to develop a custom HTTP Handler by implementing IHttpHandler interface or you could probably go with ASHX. Take a look at the walk throughs on this page. http://msdn.microsoft.com/en-us/library/system.web.ihttphandler.aspx
Your WebDAV handler will need to process the requests and dispatch the appropriate method handlers to handle the various HTTP methods (GET, POST, PUT, DELETE, MOVE, COPY etc.). Which methods you support will depending on your required level of compliance with the various WebDAV server classes. There is fortunately plenty of Java code for WebDAV that you could find and use as a reference for your implementation.
If the GPL licence is not a restriction for you, it that might be worth looking at Sphorium's WebDAV.NET http://sourceforge.net/projects/webdav/
And there are commercial options. http://www.webdavsystem.com/server
And of course the most important link, the WebDAV RFC http://www.ietf.org/rfc/rfc2518.txt
精彩评论