Webdav.Net Ajax文件浏览器:FireFox 20.0.1版本无法连接webdav服务器



我使用下面的代码在一个. net Web应用程序项目中显示ajax文件浏览器控件,我使用开发Web服务器在一个自动分配的端口上本地运行。

webdav服务器在本地IIS 7(端口80)上运行,它是一个使用webdav.net服务器库的。net应用程序。应用中的安全性设置为Windows身份验证。我也允许匿名用户的OPTIONS请求。

该页面在IE中运行良好&Chrome,但是FireFox不连接,它返回消息:位置"…/WebDav/"未找到。

我启用了Firebug,问题是Webdav服务器向OPTIONS请求返回401 Unauthorized。

有什么可以让它在FireFox中工作吗?

<%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage<dynamic>" %>
<!DOCTYPE HTML>
<html>
<head>
<title>IT Hit AJAX File Browser</title>
<!-- Always set width and height for html and body if you would like to set width and height for Ajax File Browser control to 100% -->
<style type="text/css">
    @import "AjaxFileBrowser/themes/ih_vista/include.css";
    html, body {margin: 0px; padding: 0px; width: 100%; height: 100%;}
</style>
<script src="AjaxFileBrowser/ITHitAJAXFileBrowser.js" type="text/javascript"></script>
<script type="text/javascript">
    function InitAjaxFileBrowser() {
        // Here we assume that your server is located on site root (http://server/) on the domain from which this page is loaded. 
        // If your WebDAV server is located on a different domain or on a different port the server must attach the Access-Control-Allow headers to server responses.
        var port = window.location.port == '' ? '' : ':' + window.location.port;
        var webDavServerPath = window.location.protocol + '//' + window.location.hostname + port;
        webDavServerPath = "http://localhost/WebDav";
        // Create the AJAX File Browser Settings object.
        var settings = {
            Id: 'AjaxFileBrowserContainer',     // (required) ID of the HTML control in which Ajax File Browser will be created
            Url: webDavServerPath,              // (required) the root folder to be displyed in Ajax File browser
            Style: 'height: 100%; width: 100%', // (required) always provide size of the control
            FileIconsPath: '/TestWebDavAjaxFileBrowser/AjaxFileBrowser/icons/',           // (required) path to the folder where file icons are located
            MsOfficeTemplatesPath: webDavServerPath + '/', // path to MS Office templates, always specify full path
            SelectedFolder: webDavServerPath,                        // folder to be selected, same as SetSelectedFolder call
            PluginsPath: '/TestWebDavAjaxFileBrowser/AjaxFileBrowser/plugins/'                                 // path to Java applet that opens documents directly from server
        };
        //Create control.
        var ajaxFileBrowser = new ITHit.WebDAV.Client.AjaxFileBrowser.Controller(settings);
    }
</script>
</head>
<body class="ih_vista" onload="InitAjaxFileBrowser();">
<div id="AjaxFileBrowserContainer" style="width: 100%; height: 100%"></div>
</body>
</html>

感谢更新1:

我尝试了在这里为Safari概述的解决方案:http://www.webdavsystem.com/ajaxfilebrowser/programming/authentication_ssl,但是它不起作用(无论是Safari还是FireFox)。提示输入密码,但选项请求仍然是未经授权。

我还在。net项目属性- Web选项卡中启用了NTLM身份验证。仍然不起作用,OPTIONS请求返回为未授权。

更新2:

当我在IIS中运行客户端。net应用程序而不是开发web服务器(。net客户端web应用程序和webdav服务器在端口80上本地运行在IIS中)时,我在FireFox中工作。当我在IIS中运行它时,FireFox可以工作,但Safari不行。Safari一直提示我输入密码。我仍然很好奇,看看是否有一个解决方案,当运行客户端应用程序在本地开发web服务器。

尝试在web.config中使用:

<authorization>
  <!-- 
  To support Windows Shell (Miniredirector/Web Folders) on XP and Server 2003 as well as Firefox CORS requests, OPTIONS must be 
  processed without authentication. To enable authentication of OPTIONS request, remove "allow OPTIONS" from the list below.
  -->
  <allow users="*" verbs="OPTIONS"/>
  <deny users="?"/>
  <allow users="*"/>
</authorization>

最新更新