views:

197

answers:

2

I'm trying to clearup a few questions about Silverlight to see if it's suitable for a project I've got comming up. A question I've not been able to answer is with regard to proxy connections.

Does connecting to the internet via a proxy add any complexity to the application, or is it handled transparently?

+2  A: 

Silverlight uses the browser's infrastructure for web requests. Therefore it will use the same proxy settings that the browser is configured to use.

Joel Cunningham
Thank's Joel. Does the same apply in out-of-browser mode?
Nick Higgs
That's a good question. I have not tried this but I would guess it works exactly the same as in browser support.
Joel Cunningham
+1  A: 

What Joel said is correct. In addition in SL3 you can decide to use Silverlight's networking infrastructure instead of the browser's one. You switch to it with

HttpWebRequest.RegisterPrefix("http://", WebRequestCreator.ClientHttp);

Be careful because in that case the OS proxy settings are used instead of the browser settings.


As for out-of-browser mode, I just did a simple test:

var req = HttpWebRequest.Create("http://www.google.com");
if (req.CreatorInstance == WebRequestCreator.BrowserHttp)
    MessageBox.Show("Browser");
else
    MessageBox.Show("Client");

and found that the browser's stack is the default in OOB too. They probably load some IE component, thus it should use the IE proxy settings as well.

Francesco De Vittori