views:

132

answers:

1

How to convert link to source ( string containing the URL ) to stream in silverlight?

+1  A: 

You mean you have a string containing the URL of a source, and you want to download the contents of that source?

Use WebRequest.Create to create a request object, then call BeginGetResponse on that request object. In the async callback, call EndGetResponse to get the response object. Then call GetResponseStream on the response object to get the data stream.

Note that the URL must contain the protocol e.g. http: or https:. Note that Silverlight's WebRequest class does not support non-HTTP protocols (such as FTP) out of the box.

If you know the data format, e.g. a WCF service or ADO.NET data service, there may be proxies or wrappers that will insulate you from this low-level detail.

itowlson