Silverlight: как устранить исключение безопасности HttpsCompleted в Visual Studio, а не только в IIS 7 - PullRequest
0 голосов
/ 24 марта 2011

Я пытался вызвать http://twitter.com/statuses/public_timeline.xml, используя HttpsCompleted в silverlight (как предложено здесь Как загрузить файл XML в XDocument в Silverlight? ), но он никогда не вызывается.

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

using System;
using System.Collections.Generic;
using System.Linq;
using 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();
        }
    }
}
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...