开发者

Silverlight: how to solve HttpsCompleted security exception on Visual Studio not on IIS 7 only

开发者 https://www.devze.com 2023-02-19 07:30 出处:网络
I tried to call http://twitter.com/statuses/public_timeline.xml using HttpsCompleted in silverlight (as suggested here How do I load an xml file in XDocument in Silverlight?) but it is never called.

I tried to call http://twitter.com/statuses/public_timeline.xml using HttpsCompleted in silverlight (as suggested here How do I load an xml file in XDocument in Silverlight?) but it is never called.

using System;
using System.Net;
using System.Xml.Linq;

using System;
using System.Collections.Generic;
using System.Linq;
us开发者_高级运维ing System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

public partial class MainPage : UserControl
{
    public MainPage()
    {
        InitializeComponent();
        WebClient wc = new WebClient();
        wc.DownloadStringCompleted += HttpsCompleted;
        wc.DownloadStringAsync(new Uri("http://twitter.com/statuses/public_timeline.xml"));
    }

    private void HttpsCompleted(object sender, DownloadStringCompletedEventArgs e)
    {
        if (e.Error == null)
        {
            XDocument xdoc = XDocument.Parse(e.Result, LoadOptions.None);
            textBlock1.Text = xdoc.FirstNode.ToString();
        }
    }
}
0

精彩评论

暂无评论...
验证码 换一张
取 消