Silverlight 4 WebRequest, SSL and Credentials

Posted by Snake on Stack Overflow See other posts from Stack Overflow or by Snake
Published on 2010-06-12T14:13:09Z Indexed on 2010/06/12 14:22 UTC
Read the original article Hit count: 890

Filed under:
|
|

Hi,

I've got the following code:

    public void StartDataRequest()
    {
        WebRequest.RegisterPrefix("https://", System.Net.Browser.WebRequestCreator.ClientHttp);

        WebClient myService = new WebClient
                              {
                                  AllowReadStreamBuffering = true,
                                  UseDefaultCredentials = false,
                                  Credentials = new NetworkCredential("username", "password")
                              };
        myService.UseDefaultCredentials = false;

        myService.OpenReadCompleted += this.RequestCompleted;
        myService.OpenReadAsync(new Uri("Url"));
    }

    public void RequestCompleted(object sender, System.Net.OpenReadCompletedEventArgs e)
    {
        // ...
    }

Now this works perfectly for, say, Twitter. But when I try to do it with another https service I get a security error.

This is probably because the website I try to connect too does not have a crossdomain.xml. Is there a way to bypass this? Or does the file really needs to be there? Thanks.

© Stack Overflow or respective owner

Related posts about c#

Related posts about Silverlight