【发布时间】:2014-10-09 14:15:12
【问题描述】:
我有一个 MHT(Microsoft Web 存档)文件,已添加到我的项目文件夹中。我需要此文件显示在帮助页面上的 WebView 中。我已将文件的构建操作设置为“内容”,例如 this question 推荐。然后我在页面的Loaded 事件处理程序中使用此代码。
Try
Dim strHelpNavigate = Path.Combine(Windows.ApplicationModel.Package.Current.InstalledLocation.ToString(), "\MyAppsHelp.mht")
webHelp.Navigate(New Uri(strHelpNavigate))
Catch ex As Exception
webHelp.NavigateToString("<html><head><style>body {font-family: segoe ui; color: white; background-color: black;}</style></head><body><h2>Sorry, the help page is currently unavailable.</h2></body></html>")
End Try
此代码产生异常:{"Invalid URI: The format of the URI could not be determined."}
我也尝试将"\MyAppsHelp.mht" 传递给Navigate 方法,如this question 推荐,但这会产生相同的异常,我从本地窗口看到传递给Navigate 方法的字符串是相同的无论哪种方式。
有人对如何在 WebView 中显示此文件有任何建议吗?
【问题讨论】:
标签: vb.net webview visual-studio-2013 windows-8.1 file-access