开发者

How to make a web request using https in silverlight

开发者 https://www.devze.com 2023-04-02 08:08 出处:网络
I have var client = new WebClient(); client.DownloadStringCompleted += (s, ea) => { var ret = Newtonsoft开发者_如何转开发.Json.JsonConvert.DeserializeObject(ea.Result);

I have

        var client = new WebClient();
        client.DownloadStringCompleted += (s, ea) =>
        {
            var ret = Newtonsoft开发者_如何转开发.Json.JsonConvert.DeserializeObject(ea.Result);
            .....    
        };
        var uri = new Uri("../myrest/Login", UriKind.Relative);
        client.DownloadStringAsync(uri);

This works fine. But I want to send this request over https not plain http. I try manipulating the uri address to change the scheme to https

    var url = "https://localhost/myrest/Login";// hardcoded for now
    client.DownloadStringAsync(new Uri(url, UriKind.Absolute)); 

But this doesnt work. It triggers the whole clientaccesspolicy.xml thingy. Presumably because the base URL is different from the url used to load the xap

I know I have the absolute path correct, if I just change the 'https' to 'http' all works ok

SL4


try access your Silverlight thru HTTPS and use HTTPS login.

0

精彩评论

暂无评论...
验证码 换一张
取 消