Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/silverlight/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Silverlight WP7:can';无法使用webclient.OpenReadAsync从httpget url获取img_Silverlight_Windows Phone 7_Webclient_Http Get - Fatal编程技术网

Silverlight WP7:can';无法使用webclient.OpenReadAsync从httpget url获取img

Silverlight WP7:can';无法使用webclient.OpenReadAsync从httpget url获取img,silverlight,windows-phone-7,webclient,http-get,Silverlight,Windows Phone 7,Webclient,Http Get,我需要从Windows phone7应用程序上的此API获取图像 getvmsimg 说明: API for get variable message sign (VMS) as img 网址: 格式: Image: PNG HTTP方法: GET 需要身份验证: true API价格限制: unlimited 这是我的密码 我必须首先通过另一个API获取会话密钥(完全没有问题),然后我必须将会话密钥用作httpget url中的参数。 我的钥匙100%正确,我已经检查过了。 但它在

我需要从Windows phone7应用程序上的此API获取图像

getvmsimg

说明:

API for get variable message sign (VMS) as img
网址:

格式:

Image: PNG
HTTP方法:

GET
需要身份验证:

true
API价格限制:

unlimited

这是我的密码 我必须首先通过另一个API获取会话密钥(完全没有问题),然后我必须将会话密钥用作httpget url中的参数。 我的钥匙100%正确,我已经检查过了。 但它在“image.SetSource(e.Result);”行出现错误(未指定错误)


thx,guy

你是否尝试将整个流(使用缓冲区或其他方式)写入内存流,然后使用该内存流而不是直接使用生成的流?

你在浏览器中访问了第二个url并成功了?是的,它成功地显示了img(.png)。是时候挖掘Fiddler工具了,检查您的浏览器在使用该URL时成功进行的HTTP对话,并将其与您的Silverlight应用程序尝试检索相同URL时进行的对话进行比较。
unlimited
public intsign()
{
    InitializeComponent();


    client.DownloadStringCompleted += new DownloadStringCompletedEventHandler(client_DownloadStringCompleted);
    client.DownloadStringAsync(new Uri("http://api.traffy.in.th/apis/getKey.php?appid="+appid));

}

void client_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e)
{
    rd = e.Result;
    sessionkey = MD5Core.GetHashString(appid + rd) + MD5Core.GetHashString(hiddenkey + rd);
    //MessageBox.Show(sessionkey);

    client2.OpenReadCompleted += new OpenReadCompletedEventHandler(client2_OpenReadCompleted);
    client2.OpenReadAsync(new Uri("http://athena.traffy.in.th/apis/apitraffy.php?api=getvmsimg&key=" + sessionkey + "&appid=" + appid + "&id=1&h=480&w=480"),client2);
}

void client2_OpenReadCompleted(object sender, OpenReadCompletedEventArgs e)
{
    BitmapImage image = new BitmapImage();
    image.SetSource(e.Result);
    intsignimg.Source = image;
}