Propfind:Windows资源管理器不显示第一个文件

时间:2014-04-22 12:07:09

标签: c# webdav explorer

我正在实现一个WebDAV服务器,我正在研究PROPFIND方法。

它在Cyber​​duck和BitKinex中都能正常工作。 但是当我使用Windows资源管理器时会出现问题: Windows资源管理器总是显示一个项目(文件或文件夹)太少。

在以下XML中,您可以看到当前目录中有两个文件夹(或集合)。但是,当您打开Windows资源管理器时,只显示第二个文件夹。

<D:multistatus xmlns:D="DAV:">
    <D:response>
        <D:href>http://localhost:8888/Folder/Folder1</D:href>
        <D:propstat>
            <D:prop>
                <D:creationdate>2014-04-22T12:30:31+02:00</D:creationdate>
                <D:displayname>Folder1</D:displayname>
                <D:getcontentlanguage />
                <D:getcontentlength />
                <D:getcontenttype />
                <D:getetag />
                <D:getlastmodified>
                    Tue, 22 Apr 2014 12:30:31 GMT
                </D:getlastmodified>
                <D:lockdiscovery />
                <D:resourcetype><D:collection /></D:resourcetype>
                <D:supportedlock />
                <D:ishidden>0</D:ishidden>
            </D:prop>
            <D:status>HTTP/1.1 200 OK</D:status>
        </D:propstat>
    </D:response>
    <D:response>
        <D:href>http://localhost:8888/Folder/Folder2</D:href>
        <D:propstat>
            <D:prop>
                <D:creationdate>2014-04-22T12:30:44+02:00</D:creationdate>
                <D:displayname>Folder2</D:displayname>
                <D:getcontentlanguage />
                <D:getcontentlength />
                <D:getcontenttype />
                <D:getetag />
                <D:getlastmodified>
                    Tue, 22 Apr 2014 12:30:44 GMT
                </D:getlastmodified>
                <D:lockdiscovery />
                <D:resourcetype><D:collection /></D:resourcetype>
                <D:supportedlock />
                <D:ishidden>0</D:ishidden>
            </D:prop>
            <D:status>HTTP/1.1 200 OK</D:status>
        </D:propstat>
    </D:response>
</D:multistatus>

如何让Windows资源管理器显示这两个项目?

1 个答案:

答案 0 :(得分:0)

我找到了解决这个问题的方法。 当前文件夹必须包含在响应正文中,而不仅仅包含在它的子节点中。 Windows资源管理器不会显示第一个响应元素。

上面的XML应该是什么:

<D:multistatus xmlns:D="DAV:">
<D:response>
        <D:href>http://localhost:8888/Folder/</D:href>
        <D:propstat>
            <D:prop>
                <D:creationdate>2014-04-22T12:30:30+15:00</D:creationdate>
                <D:displayname>Folder1</D:displayname>
                <D:getcontentlanguage />
                <D:getcontentlength />
                <D:getcontenttype />
                <D:getetag />
                <D:getlastmodified>
                    Tue, 22 Apr 2014 12:29:41 GMT
                </D:getlastmodified>
                <D:lockdiscovery />
                <D:resourcetype><D:collection /></D:resourcetype>
                <D:supportedlock />
                <D:ishidden>0</D:ishidden>
            </D:prop>
            <D:status>HTTP/1.1 200 OK</D:status>
        </D:propstat>
    </D:response>
    <D:response>
        <D:href>http://localhost:8888/Folder/Folder1</D:href>
        <D:propstat>
            <D:prop>
                <D:creationdate>2014-04-22T12:30:31+02:00</D:creationdate>
                <D:displayname>Folder1</D:displayname>
                <D:getcontentlanguage />
                <D:getcontentlength />
                <D:getcontenttype />
                <D:getetag />
                <D:getlastmodified>
                    Tue, 22 Apr 2014 12:30:31 GMT
                </D:getlastmodified>
                <D:lockdiscovery />
                <D:resourcetype><D:collection /></D:resourcetype>
                <D:supportedlock />
                <D:ishidden>0</D:ishidden>
            </D:prop>
            <D:status>HTTP/1.1 200 OK</D:status>
        </D:propstat>
    </D:response>
    <D:response>
        <D:href>http://localhost:8888/Folder/Folder2</D:href>
        <D:propstat>
            <D:prop>
                <D:creationdate>2014-04-22T12:30:44+02:00</D:creationdate>
                <D:displayname>Folder2</D:displayname>
                <D:getcontentlanguage />
                <D:getcontentlength />
                <D:getcontenttype />
                <D:getetag />
                <D:getlastmodified>
                    Tue, 22 Apr 2014 12:30:44 GMT
                </D:getlastmodified>
                <D:lockdiscovery />
                <D:resourcetype><D:collection /></D:resourcetype>
                <D:supportedlock />
                <D:ishidden>0</D:ishidden>
            </D:prop>
            <D:status>HTTP/1.1 200 OK</D:status>
        </D:propstat>
    </D:response>
</D:multistatus>

此处提供更多信息:http://www.webdav.org/specs/rfc2518.html#rfc.section.8.1.2