when you use asynchronous http post you should make sure that you use "Deployment.Current.Dispatcher.BeginInvoke" to a void "System.UnauthorizedAccessException" exception.
......
void DownloadNow()
{
WebClient request = new WebClient();
request.DownloadStringCompleted += new DownloadStringCompletedEventHandler(request_DownloadStringCompleted);
request.DownloadStringAsync(serviceUri);
}
void request_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e)
{
Deployment.Current.Dispatcher.BeginInvoke(() =>
{
log.Text = e.Result;
});
}
......
for more info please check this link http://forums.silverlight.net/t/66271.aspx/1?asynchronous+http+post+problem+System+UnauthorizedAccessException+Invalid+cross+thread+access+
No comments:
Post a Comment