从OOB应用程序引用浏览器 [英] Reference to a browser from OOB app

查看:93
本文介绍了从OOB应用程序引用浏览器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

请告诉我是否可以从OOB应用程序打开浏览器(假设使用HyperlinkBut​​ton点击)并获取对例如,浏览器能够读取cookie吗?

Please, let me know whether it is possible to open a browser from the OOB application (let's say using a HyperlinkButton click) and get a reference to that browser to be able to read cookies, for example?

想法是在最终用户点击按钮并等待该网页重新加载和设置时打开网页我需要读取的cookie。

The idea is to open a web page when end user clicks on a button and wait for that web page to re-load and set cookies which I then need to read.

如果这不可能,那么,我想,我需要以某种方式利用隔离存储并使用一个SL应用程序将数据设置为独立存储然后在我的OOB应用程序中阅读。

If this is not possible, then, I guess, I would need to utilize isolated storage somehow and set data into isolated storage using one SL app and then read it inside my OOB app.

非常感谢。

BR

推荐答案

您好_Qch _,

Hi _Qch_,

如果您想在浏览器中使用Silverlight OOB应用程序通过HyperlinkBut​​ton打开超链接,请尝试使用以下方法。

If you want to open a hyperlink through a HyperlinkButton in browser with Silverlight OOB application, please try with following ways.

请创建一个自定义HyperlinkBut​​ton类,该类继承自HyperlinkBut​​ton类,然后将导航URL传递给此clas用于实现导航的s。接下来,请添加用于单击HyperlinkBut​​ton本身的ClickMe()方法。
此自定义HyperlinkBut​​ton的示例代码如下所示。

Please create a custom HyperlinkButton class which is inherit from HyperlinkButton class and then pass the navigate URL to this class which used to implement to the navigation. Next, please add a ClickMe() method that used to click the HyperlinkButton itself. The sample code for this custom HyperlinkButton shown in below.

public class MyHyperlinkButton : HyperlinkButton
    {
        public MyHyperlinkButton(string navigateUri)
        {

            base.NavigateUri = new Uri(navigateUri);

            TargetName = "_blank";

        }

        public void ClickMe()
        {
            base.OnClick();
        }

    }

然后在Silverlight客户端使用此自定义超链接,如下所示。

Then use this custom Hyperlink in your Silverlight client side as below shows.

<HyperlinkButton x:Name="btnMyURL" Content="Click Here" Click="btnMyURL_Click"/>




 private void btnMyURL_Click(object sender, RoutedEventArgs e)
        {
            MyHyperlinkButton button = new MyHyperlinkButton("http://www.microsoft.com");
            button.ClickMe();
        }

但是如果你想在Silverlight OOB应用程序中从浏览器中读取cookie,我担心我们无法访问表单身份验证cookie或者来自客户端的ASP.NET会话cookie,因为它们是使用HttpOnly标志发出的。请
参考:

But if you want to read the cookies from the browser in Silverlight OOB application, I'm afraid that we could not access the forms authentication cookie or the ASP.NET session cookie from client side because they are emitted with the HttpOnly flag. Please refer to:

http://stackoverflow.com/questions/15172110/is-there-any-way-to-make-clienthttp-stack-to-use-browser-cookies

最好的问候,

Weiwei


这篇关于从OOB应用程序引用浏览器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆