1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

asp.net-C# how to remove the uploaded file in IIS server

Discussion in 'C#' started by alanX, Jan 2, 2007.

  1. #1
    Hi all,
    How can i remove the uploaded file in IIS server through the web script(C# , asp.net). Can anyone give any function for that?

    thanks :)
     
    alanX, Jan 2, 2007 IP
  2. ccoonen

    ccoonen Well-Known Member

    Messages:
    1,606
    Likes Received:
    71
    Best Answers:
    0
    Trophy Points:
    160
    #2
    Use FSO or System.IO to do all your file handling/management or teh File Scope

    using System.IO;
    File.Delete("C:\\MyFiles\\SomeFile.xml");
     
    ccoonen, Jan 4, 2007 IP
  3. FPImages

    FPImages Peon

    Messages:
    3
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Or
    File.Delete (Server.MapPath(YourVirtualPath));
    if you are working with virtual directories in your web page
     
    FPImages, Mar 15, 2007 IP
  4. ccoonen

    ccoonen Well-Known Member

    Messages:
    1,606
    Likes Received:
    71
    Best Answers:
    0
    Trophy Points:
    160
    #4
    AHH - he did say C#/ASP.NET - sorry, yah, you an import the System.IO scope and use File.Delete method from that scope. Don't use FSO if you are not using Classic ASP ;)
     
    ccoonen, Mar 16, 2007 IP
  5. ilan7251

    ilan7251 Peon

    Messages:
    1
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    File.Delete(Server.MapPath("~/" + path));

    hope this helps
     
    ilan7251, Mar 31, 2012 IP