Deleting a directory results in application restart

后端 未结 5 2291
深忆病人
深忆病人 2020-12-06 14:29

I have an application with 2 directories (books and export). If we create a book or a page of a book in the application a directory is added with the id of the page (this is

5条回答
  •  独厮守ぢ
    2020-12-06 15:06

    Oh and putting the directory outside the virtual directory is not an option.

    Putting the directory outside the virtual directory is the only solution I found (so far). What you can do, is to create a link (junction) in the file system so that the directory appears to be inside the virtual directory, e.g:

    • Our web site (virtual directory) is located at C:\projectX\website
    • the data directory (where we create/delete files and folders) is located at C:\projectX\data
    • then we create a link which makes the data folder available as C:\projectX\website\data

    The link is created using the program Linkd.exe (available in the windows resource kit), with the following command:

    linkd c:\projectX\website\data c:\projectX\data
    

    Now c:\projectX\website\data is a link/junction which points to the real data directory. You can work with the link as if it were a physical directory.

    E.g. in your web site you can access it using this code:

    Server.MapPath("~/data")
    

    And you can also used the windows file explorer and browse to C:\projectX\website\data. It appears just like a real directory.

提交回复
热议问题