locked
ActionResult that Create A folder.... RRS feed

  • Question

  • User-507786106 posted

    I have to build a FileManager in my application, and need to be efficient way to create System.IO.Folder within my Interface. Basically the interface should do all the work once I pass the values to it. 

    I need an Interface that Creates a folder in this path of the project:

    Interface Parameter is (string _folderName, string _folderPath)

    Actual Path:   ~/App_Data/Root/

    The return values should be: folderPath and folderName

    ActionResult:    How do I call my Interface to pass new folder, and path name to be created?

    The web application is in a project separate from the Interface called Services. Is this possible, if so please help...

    Wednesday, June 7, 2017 8:06 PM

Answers

  • User-832373396 posted

    Hi slimbunny,

    Please refer to code below:

    string path = Server.MapPath("~/App_Data/Root");//Server.MapPath(_folderPath+ "/"+_folderName);
    if (Directory.Exists(path) == false)//if it doesn't exist
    { Directory.CreateDirectory(path));// create a folder }

    Best regards,

    Jolie

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, June 8, 2017 7:14 AM