简体   繁体   中英

How to convert link to source to stream in silverlight?

如何将链接转换为源(包含URL的字符串)以在Silverlight中流式传输?

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 eg 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, eg a WCF service or ADO.NET data service, there may be proxies or wrappers that will insulate you from this low-level detail.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM