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. Unable to download file from server

Unable to download file from server

Scheduled Pinned Locked Moved ASP.NET
helpsysadminannouncementcareer
4 Posts 2 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.
  • V Offline
    V Offline
    vayanan
    wrote on last edited by
    #1

    Hi I am not able to download file from Web Server... I am using following code

        string filename = "Resume.doc";
        string path = Server.MapPath("~/Resumes/" + filename );
        Response.Clear();
        Response.AddHeader("Content-Disposition", "attachment;
    

    filename=" + filename );

        Response.ContentType = "application/octet-stream";
        Response.WriteFile(path);
        Response.End();
    

    this code is working fine in localhost... but when Execute in the server it says 'File not found in the Directory',but file exists on the server. The website id done in ASP only the file upload and download is done in ASPX, upload is working fine but download is creating the problem. may be because of Version compatibility,I am using GODaddy Share WebHosting. please help me to find the solution. Thanks and Regards Vayanan

    L 1 Reply Last reply
    0
    • V vayanan

      Hi I am not able to download file from Web Server... I am using following code

          string filename = "Resume.doc";
          string path = Server.MapPath("~/Resumes/" + filename );
          Response.Clear();
          Response.AddHeader("Content-Disposition", "attachment;
      

      filename=" + filename );

          Response.ContentType = "application/octet-stream";
          Response.WriteFile(path);
          Response.End();
      

      this code is working fine in localhost... but when Execute in the server it says 'File not found in the Directory',but file exists on the server. The website id done in ASP only the file upload and download is done in ASPX, upload is working fine but download is creating the problem. may be because of Version compatibility,I am using GODaddy Share WebHosting. please help me to find the solution. Thanks and Regards Vayanan

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      vayanan wrote:

      string path = Server.MapPath("~/Resumes/" + filename );

      Try to print the file path on screen and then check....

      Regards Aman Bhullar www.arlivesupport.com[^]

      V 1 Reply Last reply
      0
      • L Lost User

        vayanan wrote:

        string path = Server.MapPath("~/Resumes/" + filename );

        Try to print the file path on screen and then check....

        Regards Aman Bhullar www.arlivesupport.com[^]

        V Offline
        V Offline
        vayanan
        wrote on last edited by
        #3

        Hi Thanks for your kind reply.. Path is correct only.. It is working fine when I use the same code in different Domain in the same server

        L 1 Reply Last reply
        0
        • V vayanan

          Hi Thanks for your kind reply.. Path is correct only.. It is working fine when I use the same code in different Domain in the same server

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          Please check the folder rights in the error domain. Do the current user have read rights on folder. Also try to download the file from direct link.

          Regards Aman Bhullar www.arlivesupport.com[^]

          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