securityexception未得到处理

时间:2013-04-14 15:31:10

标签: json windows-phone-7 windows-phone-8 json.net foursquare

我只是尝试使用foursquare场所API解析json,并在我的windowphone应用程序的列表框中显示一些位置,但是当我运行这行代码时,我一直收到错误securityexception未处理。

var providerResult =(Venues.RootObject)dataContractJsonSerializer.ReadObject(stream);

in

 private void client_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e) {
        if (e.Error == null) {

            using (MemoryStream stream = new MemoryStream(Encoding.UTF8.GetBytes(e.Result))) {
                DataContractJsonSerializer dataContractJsonSerializer = new DataContractJsonSerializer(typeof(Venues.RootObject));
                var providerResult = (Venues.RootObject)dataContractJsonSerializer.ReadObject(stream);

                if (providerResult == null) {
                    MessageBox.Show("No location were found");
                }
                else {
                    locations.ItemsSource = providerResult.response.venues;
                }
            }
        }
        else {
            MessageBox.Show(e.Error.Message);
        }
    }

0 个答案:

没有答案