Downloading file from server
-
hi I want to download file from the server. For this purpose i created a web service which returns a byte array of file. On silverlight page.xaml i got the byte array but how can i convert it to file so that i can save file to client hard disk. If there is any other way to download file from server plz tell me. Thanks in advance.
-
hi I want to download file from the server. For this purpose i created a web service which returns a byte array of file. On silverlight page.xaml i got the byte array but how can i convert it to file so that i can save file to client hard disk. If there is any other way to download file from server plz tell me. Thanks in advance.
In Silverlight 2, the only access you have to the user's local hard disk is using Isolated Storage: Silverlight Isolated Storage[^] Silverlight 3, now in beta, provides a save-file dialog that will allow the user to select a place you can save the file to. Note that this will still require user interaction - you won't be able to just write anywhere you want to. Mark
Mark Salsbery Microsoft MVP - Visual C++ :java:
-
In Silverlight 2, the only access you have to the user's local hard disk is using Isolated Storage: Silverlight Isolated Storage[^] Silverlight 3, now in beta, provides a save-file dialog that will allow the user to select a place you can save the file to. Note that this will still require user interaction - you won't be able to just write anywhere you want to. Mark
Mark Salsbery Microsoft MVP - Visual C++ :java:
-
hi I want to download file from the server. For this purpose i created a web service which returns a byte array of file. On silverlight page.xaml i got the byte array but how can i convert it to file so that i can save file to client hard disk. If there is any other way to download file from server plz tell me. Thanks in advance.
You can do it using a trick. Instead of calling the web service, from Silverlight call javascript method that will make an open to a given URL, this URL will point to a custom HTTP handler, then you return your file (implementing a custom HTTP handler it's easy can send you some info or link), you only has to say that the file is an attachment. In my case I just render e jpeg, js: function showReportDiagramPopup() { //http: //www.javascripter.net/faq/openinga.htm window.open("DiagramRenderPopup.aspx", "DatabaseDiagram", "scrollbars=yes, width=800,height=600", false); // NOT IN USE, rather using popup // Finally we are not going to use a popup, we just open the generated image as an attachment //window.location = "DiagramImageHandler.ashx" } In Silverlight: public void ShowDiagramImageRenderPopup() { System.Windows.Browser.HtmlPage.Window.CreateInstance("showReportDiagramPopup"); } HTH Braulio
/// ------------------------- Braulio Díez DBSchemaEditor.com Free Silverlight based DB Schema Modeling Tool /// -------------------------