开发者

Silverlight: Stream file to new HTML browser window to prompt user to "open or save as..."?

开发者 https://www.devze.com 2023-03-30 15:26 出处:网络
What would be the most efficient way, if it can be done, to stream or send 开发者_如何学JAVAa file (byte array) from a Silverlight in-browser application to a new HTML window in a way that will prompt

What would be the most efficient way, if it can be done, to stream or send 开发者_如何学JAVAa file (byte array) from a Silverlight in-browser application to a new HTML window in a way that will prompt the user to either open the file with the default OS application associated, or save the file?

I'm using a save file dialog to allow them to save the file if need be, but I have a requirement such that if a user clicks the file in my application, the standard operating system "open/save" dialog should pop.


Since the file is on the server why not let the browser handle it all:-

 HtmlPage.Window.Navigate(urlToFile, "_blank");


It sounds like your requirements are for a desktop app, not a Silverlight app. Ever looked into ClickOnce?

The most plausible way I can think of doing this is sending the file to a remote server and then directing your user to that server. Which is probably not what you're looking for.

Then there's the option of opening a socket and effectively turning your Silverlight app into a server. Then open a new browser window and have it point to localhost:portnum. However you would need to implement some protocol that the browser understands, like FTP or HTTP. Which seems a bit ludicrous.

0

精彩评论

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