用 C# 实现 WebDAV 服务器?
我们有一个用 .NET C# 编写的 CMS 系统。该系统具有模板(本质上是 HTML 文件)和各种其他支持文件(例如 CSS 和 javascript 文件)的编辑功能。
这些“文件”并不是真正的文件,而是数据库记录,它们是使用 CMS 系统中的纯旧文本区域进行编辑的。
为了使编辑这些“文件”变得更容易,一种想法是在 CMS 系统中为这些文件实现 WebDAV 支持,这样用户就可以使用一些 WebDAV 客户端软件连接到 CMS,然后在 VS 2008 等中打开它们。
首先,这个想法可行吗?
其次,如果是这样……从哪里开始?有没有关于在 C# 中实现 WebDAV 服务器以提供对物理文档或“伪”文档(实际上只是数据库中的记录)的访问的好文章?
任何意见表示赞赏......
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 articles 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 ....
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
一种方法是通过实现 IHttpHandler 接口来开发自定义 HTTP 处理程序,或者您也可以使用 ASSX。查看此页面上的演练。
http://msdn.microsoft.com/en-us/library /system.web.ihttphandler.aspx
您的 WebDAV 处理程序需要处理请求并分派适当的方法处理程序来处理各种 HTTP 方法(GET、POST、PUT、DELETE、MOVE、COPY 等)。您支持哪种方法取决于您对各种 WebDAV 服务器类的合规性要求。幸运的是,您可以找到大量用于 WebDAV 的 Java 代码并将其用作实现的参考。
如果 GPL 许可证对您没有限制,那么 Sphorium 的 WebDAV.NET 可能值得一看
http://sourceforge.net/projects/webdav/
还有商业选项。
http://www.webdavsystem.com/server
当然还有最重要的链接,WebDAV RFC
http://www.ietf.org/rfc/rfc2518.txt
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