Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/289.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/.net/21.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 即使文件存在,Webbrowser导航也已取消_C#_.net - Fatal编程技术网

C# 即使文件存在,Webbrowser导航也已取消

C# 即使文件存在,Webbrowser导航也已取消,c#,.net,C#,.net,我已经浏览了这个问题,但它不是很有用:(或者我没听懂) 在我的应用程序(C#.NET 4.5)中,我使用a来显示PDF的内容。我尝试使用以下代码导航到文件的本地URL(我可以用浏览器打开): m_path = pdfDoc.CreateReportFile(); try { webBrowser1.Navigate(new Uri(m_path)); } catch (Exception e) { Console.WriteLine("{0} Exception caug

我已经浏览了这个问题,但它不是很有用:(或者我没听懂)

在我的应用程序(C#.NET 4.5)中,我使用a来显示PDF的内容。我尝试使用以下代码导航到文件的本地URL(我可以用浏览器打开):

m_path = pdfDoc.CreateReportFile();
try
{
   webBrowser1.Navigate(new Uri(m_path));
}
catch (Exception e)
{
    Console.WriteLine("{0} Exception caught.", e);
}
但是导航总是被取消,即使我尝试重新加载页面。没有抛出异常

我能做什么

以下是URL:
C:\\Users\\me\\AppData\\Local\\Temp\\LY20_2014-11-25_06#22M1[1]。pdf

如果我将其粘贴到IE中,删除转义的
\
,则文件将打开

更新:
  • 当输入字符串
    @时,webbrowser工作正常http://www.google.fr“
  • 使用PDF文件地址时,会在导航取消消息后在Acrobat Reader中打开该文件

    • 感谢亲爱的Adobe和Microsoft,至少他们是诚实的:

      Microsoft已确认这是“应用于”部分中列出的Microsoft产品中的一个问题


      你知道那样抓和抓是没有用的,不是吗?你能发布完整的url吗?@Andrew see edited post:)你尝试过用相同的代码打开现有的PDF吗?@Martindille你的意思是用PDF文件替换m_路径吗?不。在不调用pdfDoc.CreateReportFile()的情况下测试你的代码,并为m_路径指定一个有效的PDF文件路径。