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. Web Development
  3. ASP.NET
  4. downloading file

downloading file

Scheduled Pinned Locked Moved ASP.NET
help
5 Posts 4 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
    sahoo fm
    wrote on last edited by
    #1

    Hi, I want to down load and save a folder on client machine. please help

    A S 2 Replies Last reply
    0
    • S sahoo fm

      Hi, I want to down load and save a folder on client machine. please help

      A Offline
      A Offline
      Abhishek Sur
      wrote on last edited by
      #2

      User this :

      string filename = "x.dat";
      HttpContext.Current.Response.Clear();
      HttpContext.Current.Response.AppendHeader("content-disposition", "attachment; filename=" + filename);
      HttpContext.Current.Response.ContentType = "application/exe"; //Change it to your mimetype.
      HttpContext.Current.Response.BinaryWrite(filebytes);
      HttpContext.Current.Response.Flush();
      HttpContext.Current.Response.Close();

      You can use Response.TransferFile/ or directly Response.Write based on your content. ;)

      Abhishek Sur **Don't forget to click "Good Answer" if you like this Solution.


      My Latest Articles-->** Simplify Code Using NDepend
      Basics of Bing Search API using .NET
      Microsoft Bing MAP using Javascript

      A 1 Reply Last reply
      0
      • S sahoo fm

        Hi, I want to down load and save a folder on client machine. please help

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

        Are you looking for this? http://www.west-wind.com/weblog/posts/76293.aspx[^]

        LatestArticle :Log4Net Why Do Some People Forget To Mark as Answer .If It Helps.

        1 Reply Last reply
        0
        • A Abhishek Sur

          User this :

          string filename = "x.dat";
          HttpContext.Current.Response.Clear();
          HttpContext.Current.Response.AppendHeader("content-disposition", "attachment; filename=" + filename);
          HttpContext.Current.Response.ContentType = "application/exe"; //Change it to your mimetype.
          HttpContext.Current.Response.BinaryWrite(filebytes);
          HttpContext.Current.Response.Flush();
          HttpContext.Current.Response.Close();

          You can use Response.TransferFile/ or directly Response.Write based on your content. ;)

          Abhishek Sur **Don't forget to click "Good Answer" if you like this Solution.


          My Latest Articles-->** Simplify Code Using NDepend
          Basics of Bing Search API using .NET
          Microsoft Bing MAP using Javascript

          A Offline
          A Offline
          Abhijit Jana
          wrote on last edited by
          #4

          That is correct answer. But you also need to mentioned that he can't download one folder (Which he was asked ). He can Zip and download the file in the way the you have specified. Thanks !

          Abhijit Jana | Codeproject MVP Web Site : abhijitjana.net Don't forget to click "Good Answer" on the post(s) that helped you.

          A 1 Reply Last reply
          0
          • A Abhijit Jana

            That is correct answer. But you also need to mentioned that he can't download one folder (Which he was asked ). He can Zip and download the file in the way the you have specified. Thanks !

            Abhijit Jana | Codeproject MVP Web Site : abhijitjana.net Don't forget to click "Good Answer" on the post(s) that helped you.

            A Offline
            A Offline
            Abhishek Sur
            wrote on last edited by
            #5

            Yes ... I didnt see that .... :omg: One cant download a folder directly.. . :laugh: :laugh:

            Abhishek Sur **Don't forget to click "Good Answer" if you like this Solution.


            My Latest Articles-->** Simplify Code Using NDepend
            Basics of Bing Search API using .NET
            Microsoft Bing MAP using Javascript

            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