Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. WPF
  4. Downloading file from server

Downloading file from server

Scheduled Pinned Locked Moved WPF
wpfsysadmindata-structuresquestion
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    sumit7034
    wrote on last edited by
    #1

    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.

    M B 2 Replies Last reply
    0
    • S sumit7034

      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.

      M Offline
      M Offline
      Mark Salsbery
      wrote on last edited by
      #2

      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:

      S 1 Reply Last reply
      0
      • M Mark Salsbery

        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:

        S Offline
        S Offline
        sumit7034
        wrote on last edited by
        #3

        Thanks

        1 Reply Last reply
        0
        • S sumit7034

          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.

          B Offline
          B Offline
          Braulio Dez
          wrote on last edited by
          #4

          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 /// -------------------------

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups