Silverlight: how to solve HttpsCompleted security exception on Visual Studio not on IIS 7 only
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();
}
}
}
精彩评论