ghost_mv
ghost_mv

Reputation: 1200

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

What would be the most efficient way, if it can be done, to stream or send a 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.

Upvotes: 4

Views: 2437

Answers (2)

AnthonyWJones
AnthonyWJones

Reputation: 189457

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

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

Upvotes: 2

Phil
Phil

Reputation: 6679

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.

Upvotes: 1

Related Questions