vs2008 测试silverlight做的控件发生安全性错误
代码如下 void SearchBtn_Click(object sender, RoutedEventArgs e)
{
// Retrieve Topic to Search for from WaterMarkTextBox
string topic = txtSearchTopic.Text;
// Construct Digg REST URL
string diggUrl = String.Format("http://services.digg.com/stories/topic/{0}?count=20&appkey=http%3A%2F%2Fscottgu.com&type=xml", topic);
// Initiate Async Network call to Digg
WebClient diggService = new WebClient();
diggService.DownloadStringCompleted += new DownloadStringCompletedEventHandler(DiggService_DownloadStoriesCompleted);
diggService.DownloadStringAsync(new Uri(diggUrl));
}
void DiggService_DownloadStoriesCompleted(object sender, DownloadStringCompletedEventArgs e)
{
if (e.Error == null)
{
DisplayStories(e.Result);
}
}
求解
[解决办法]
有没有使用Vs2010调试过呢?效果如何?
[解决办法]
string diggUrl = String.Format("http://services.digg.com/stories/topic/{0}?count=20&appkey=http%3A%2F%2Fscottgu.com&type=xml", topic);
你测试了这个URL了么?其中使用的appkey是http%3A%2F%2Fscottgu.com,你并非这个appkey的拥有者,会出现安全性错误。
服务访问,需要注意服务权限认证后,才能调用成功。