Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/299.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# Launchurisync未导航到正确的uri_C#_Windows 8_Microsoft Metro - Fatal编程技术网

C# Launchurisync未导航到正确的uri

C# Launchurisync未导航到正确的uri,c#,windows-8,microsoft-metro,C#,Windows 8,Microsoft Metro,我需要导航到metro应用程序中的internet页面。 我的url是(示例)'http://www.foo.com/#/foo'. 问题是Launchurisync将url剪切为'http://www.foo.com" try { Uri uri = new Uri(item.UriCode); await Launcher.LaunchUriAsync(uri); } catch (Exception exception) { //TODO } 我错在哪里? 问

我需要导航到metro应用程序中的internet页面。 我的url是(示例)'http://www.foo.com/#/foo'. 问题是Launchurisync将url剪切为'http://www.foo.com"

try
{
    Uri uri = new Uri(item.UriCode); 
    await Launcher.LaunchUriAsync(uri);
}
catch (Exception exception)
{
    //TODO
}
我错在哪里? 问候

更新:

我精确表示uri=。
因此,问题来自Launchurisync。

我尝试使用相同的代码,只是硬编码了您提到的uri 请检查以下代码:

    /// <summary>
    /// Invoked when this page is about to be displayed in a Frame.
    /// </summary>
    /// <param name="e">Event data that describes how this page was reached.  The Parameter
    /// property is typically used to configure the page.</param>
    protected async override void OnNavigatedTo(NavigationEventArgs e)
    {
        try
        {
            Uri uri = new Uri("http://www.foo.com/#/foo");
            await Launcher.LaunchUriAsync(uri);
        }
        catch (Exception exception)
        {
            //TODO
        }
    }
//
///当此页面即将显示在框架中时调用。
/// 
///描述如何到达此页面的事件数据。参数
///属性通常用于配置页面。
受保护的异步重写无效OnNavigatedTo(NavigationEventArgs e)
{
尝试
{
Uri=新的Uri(“http://www.foo.com/#/foo");
wait Launcher.launchurisync(uri);
}
捕获(异常)
{
//待办事项
}
}
输出如下所示

我想还有其他问题。
可能与
项有关。UriCode
行请检查。

我认为很难从您的示例中诊断出实际的错误

看起来您正试图导航到网页中的锚,但使用错误的语法/指向不存在的锚。但是,您的示例链接页面似乎不包含可导航锚

假设这正是您试图实现的目标,请尝试下面的示例,您将看到导航按预期工作

Launcher.LaunchUriAsync(new Uri("http://www.hypergurl.com/anchors.html#bottom"));

如果这不是您想要实现的,我建议IE将URI中存在的
#
字符解释为锚引用,这就是您无法获得所需结果的原因。

我正在尝试导航到一个接受类似导航的flash网站。但你是对的,这似乎是问题所在。
后面的斜杠不应该省略或编码吗?foo.com/#menuNo正确的url是。它起作用了。所以url不是问题所在。谢谢你的回复。但是硬编码并不能改变这个问题。item.UriCode具有正确的值。该示例即使没有硬编码也可以工作,并且地址栏似乎反映了正确的URL。你有这种格式的真实URL的样本吗?我们可以试试。就连我也面临这个问题。我试图用外部浏览器打开一个url,但如果默认浏览器不是IE,它会忽略
#片段