开发者

ASP.Net page or handler to load mp3/avi and send to browser - BOTH internal file path and external url as source

开发者 https://www.devze.com 2023-02-08 13:06 出处:网络
So there are many examples of getting the stream from a file locally, but suppose i want to stream an MP3 from another site.

So there are many examples of getting the stream from a file locally, but suppose i want to stream an MP3 from another site.

I have a page that lists urls of MP3s, for example, one might be...

www.domain.com/getResource.aspx?ResourceId=123

This page can obviously fairly simply load Resource 123, and send开发者_运维问答 to the browser.

Suppose resource 123 is not local, it is a URL to another site which serves up the mp3

so my question is what is the best way for this Resource Page to get the data from the remote source and send back to the browser. In effect, there should be no differential as far as the client is concerned where the file has come from. It always goes through this aspx (or ashx) page


Your site would need to make its own HTTP request to the remote server. Take the content of the response, and write it to the response stream of the request that came to your site.

0

精彩评论

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