I get security exception when using System.Net.WebClient to do HTTP requests, which is due to the fact that crossdomain.xml or clientaccesspolicy.xml on the target server are either missing or are too restrictive. I know there is a good reason for this (cookies and cross-site request forgery), but it does not apply in my case since all I need is doing plain HTTP GET requests to arbitrary URLs without using cookies or anything fancy.
I already thought of an idea of a proxy that will fetch the URLs, but that sounds more like an ugly workaround, not to mention the waste of bandwidth.
What is the way (if there is one) to do it in Silverlight? Am I using the right class?
I think that that is actually not possible, at least with WebClient. The whole idea is to restrict (protect…) the clients from unwanted requests to other servers.
To get around that, what you can do is have a proxy webservice that will call the ‘arbitrary URLs’ from your web server, and pass the results back to the Silverlight client. That way the clients stay protected while you achieve the functionality you want.