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. delete file from drive

delete file from drive

Scheduled Pinned Locked Moved ASP.NET
questioncsharpasp-net
6 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.
  • P Offline
    P Offline
    playout
    wrote on last edited by
    #1

    Hi, I know with the "file upload" control you can upload files, but my question is, how can I delete those files, or delete a specific file from my hdd if I know the path, using asp.net?

    T 1 Reply Last reply
    0
    • P playout

      Hi, I know with the "file upload" control you can upload files, but my question is, how can I delete those files, or delete a specific file from my hdd if I know the path, using asp.net?

      T Offline
      T Offline
      ToddHileHoffer
      wrote on last edited by
      #2

      System.IO.File.Delete("FilePath");


      how vital enterprise application are for proactive organizations leveraging collective synergy to think outside the box and formulate their key objectives into a win-win game plan with a quality-driven approach that focuses on empowering key players to drive-up their core competencies and increase expectations with an all-around initiative to drive up the bottom-line. But of course, that's all a "high level" overview of things --thedailywtf 3/21/06

      P 1 Reply Last reply
      0
      • T ToddHileHoffer

        System.IO.File.Delete("FilePath");


        how vital enterprise application are for proactive organizations leveraging collective synergy to think outside the box and formulate their key objectives into a win-win game plan with a quality-driven approach that focuses on empowering key players to drive-up their core competencies and increase expectations with an all-around initiative to drive up the bottom-line. But of course, that's all a "high level" overview of things --thedailywtf 3/21/06

        P Offline
        P Offline
        playout
        wrote on last edited by
        #3

        Thanks Just one question. Will "FilePath" be the complete path from "C:\" or from within the application path on IIS or server? EG http://localhost/invoices/mysheet.doc

        T 1 Reply Last reply
        0
        • P playout

          Thanks Just one question. Will "FilePath" be the complete path from "C:\" or from within the application path on IIS or server? EG http://localhost/invoices/mysheet.doc

          T Offline
          T Offline
          ToddHileHoffer
          wrote on last edited by
          #4

          Use the actually file path "C:\"


          how vital enterprise application are for proactive organizations leveraging collective synergy to think outside the box and formulate their key objectives into a win-win game plan with a quality-driven approach that focuses on empowering key players to drive-up their core competencies and increase expectations with an all-around initiative to drive up the bottom-line. But of course, that's all a "high level" overview of things --thedailywtf 3/21/06

          B 1 Reply Last reply
          0
          • T ToddHileHoffer

            Use the actually file path "C:\"


            how vital enterprise application are for proactive organizations leveraging collective synergy to think outside the box and formulate their key objectives into a win-win game plan with a quality-driven approach that focuses on empowering key players to drive-up their core competencies and increase expectations with an all-around initiative to drive up the bottom-line. But of course, that's all a "high level" overview of things --thedailywtf 3/21/06

            B Offline
            B Offline
            Baj22
            wrote on last edited by
            #5

            You can use Server.MapPath to translate from the relative path to the absolute. You may run into permissions exceptions, just a heads up. ~A

            T 1 Reply Last reply
            0
            • B Baj22

              You can use Server.MapPath to translate from the relative path to the absolute. You may run into permissions exceptions, just a heads up. ~A

              T Offline
              T Offline
              ToddHileHoffer
              wrote on last edited by
              #6

              It is true, we have a have web farm so we have two IIS servers running the same site. We can't even write files because the account running aspnet doesn't have access to the network drives. Users can't save files to local drives because it is two machines. After 2 years, I finally came up with a work around. I created a web service that impersonates a windows account and accepts a byte array as a parameter. I call the web service to write files to a networked directory that the impersonated account has access to. I should write an article about it.


              how vital enterprise application are for proactive organizations leveraging collective synergy to think outside the box and formulate their key objectives into a win-win game plan with a quality-driven approach that focuses on empowering key players to drive-up their core competencies and increase expectations with an all-around initiative to drive up the bottom-line. But of course, that's all a "high level" overview of things --thedailywtf 3/21/06

              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