How to Delete a Doc File from a Asp.net Page Button Click ?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • hellboss
    New Member
    • Jun 2007
    • 50

    How to Delete a Doc File from a Asp.net Page Button Click ?

    HI !

    I am workin wit asp.net vs 05 , I have some document file in my local directory and its corresponding path and its file name is strored in a the database table. In the Page 1, i have listed out all the Current doc which are present in my directory and, What i need is to delete a particular Doc file which is been selected,

    I use the Query string to send the file path and the file name to a procedure when its been clicked,

    ex: C:\Docfiles\Exa mpleFile1.doc ( this path and file name is Concated Before passing)

    My Question !
    How to Delete a local file ,Having the file name and path with me , hw do i implement it ??

    Kindly provide me with a valid solution.

    Thanks in Advance !!
  • shweta123
    Recognized Expert Contributor
    • Nov 2006
    • 692

    #2
    Hi,

    On your page Import the namespace.

    Imports System.IO

    Delete the file using

    File.Delete(Pat hname)

    Comment

    • hellboss
      New Member
      • Jun 2007
      • 50

      #3
      Originally posted by shweta123
      Hi,

      On your page Import the namespace.

      Imports System.IO

      Delete the file using

      File.Delete(Pat hname)
      Thanks That Worked !

      Comment

      Working...