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. Other Discussions
  3. The Weird and The Wonderful
  4. is it good way for download ?

is it good way for download ?

Scheduled Pinned Locked Moved The Weird and The Wonderful
sysadminquestionlearning
2 Posts 2 Posters 10 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.
  • P Offline
    P Offline
    PavanPareta
    wrote on last edited by
    #1

    (DOWNLOAD Book)link where would u make it. DOWNLOAD Book a href="dnload.aspx?filebook=../pdf/book.pdf dnload.aspx

            // download page load event
            string strRequest = Request.QueryString["filebook"];
            if (strRequest != "")
            {
                string path = Server.MapPath(strRequest);
                System.IO.FileInfo file = new System.IO.FileInfo(path);
                if (file.Exists == true)
                {
                    Response.Clear();
                    Response.AddHeader("Content-Disposition", "attachment; filename=" + filebook.Name);
                    Response.AddHeader("Content-Length", file.Length.ToString());
                    Response.ContentType = "application/octet-stream";
                    Response.WriteFile(filebook.FullName);
                    Response.End();
                }
                else
                {
                    Response.Write("This file does not exist.");
                }
            }
            else
            {
                Response.Write("Please provide a file to download.");
            }
    

    Pavan Pareta

    V 1 Reply Last reply
    0
    • P PavanPareta

      (DOWNLOAD Book)link where would u make it. DOWNLOAD Book a href="dnload.aspx?filebook=../pdf/book.pdf dnload.aspx

              // download page load event
              string strRequest = Request.QueryString["filebook"];
              if (strRequest != "")
              {
                  string path = Server.MapPath(strRequest);
                  System.IO.FileInfo file = new System.IO.FileInfo(path);
                  if (file.Exists == true)
                  {
                      Response.Clear();
                      Response.AddHeader("Content-Disposition", "attachment; filename=" + filebook.Name);
                      Response.AddHeader("Content-Length", file.Length.ToString());
                      Response.ContentType = "application/octet-stream";
                      Response.WriteFile(filebook.FullName);
                      Response.End();
                  }
                  else
                  {
                      Response.Write("This file does not exist.");
                  }
              }
              else
              {
                  Response.Write("Please provide a file to download.");
              }
      

      Pavan Pareta

      V Offline
      V Offline
      Vasudevan Deepak Kumar
      wrote on last edited by
      #2

      It does not sound logical. One can just entrap querystring and then manually build the path, defeat the download statistics routine or an optional logon check. You should pass some ID and read the file on serverside and stream it. The file should be away from virtual folder.

      Vasudevan Deepak Kumar Personal Homepage Tech Gossips

      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