从WebBrowser-Control打开Windows资源管理器(WebDAV)失败

时间:2012-02-08 15:18:54

标签: wpf webbrowser-control webdav

使用简单的html片段(另存为test.html)很容易重现此问题:

<style>
    a { behavior: url(#default#AnchorClick); }
</style>
<a href="https://webdav.mc.gmx.net/" folder="https://webdav.mc.gmx.net/" target="_blank">open</a>

如果您在InternetExplorer中打开test.html并单击打开的链接,则会弹出一个带有指定WebDAV文件夹的新Windows资源管理器。这正是我所期待的。

现在,如果我在WPF WebBrowser-Control中打开test.html,行为就不同了。它会打开一个新的Internet Explorer窗口,显示HTTP 405错误。

以下是在WPF WebBrowser中测试它的XAML和Code-Behind:

<Window x:Class="Misc.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow" Height="350" Width="525">
    <WebBrowser x:Name="_browser" />

using System.IO;

namespace Misc
{
    public partial class MainWindow
    {
        public MainWindow()
        {
            InitializeComponent();
            var folder = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
            var file = Path.Combine(folder, "test.html");
            _browser.Navigate(file);
        }
    }
}

注:

  • 在这两种情况下,因为它是本地文件,您需要先“允许阻止内容”(顶部的黄色栏)。
  • 此示例中的URL不是真实的,因为它只能在Intranet上访问。真实的URL指向SharePoint WebDAV文件夹。

1 个答案:

答案 0 :(得分:0)

已解决:SP1中的一个修补程序修复了此问题。不知道究竟是哪一个,但这里是完整的清单:

相关问题