开发者

Using XML to display file structure some folders on an ASP.NET site

In a previous question I got two smart solution this problem that I intend to use in the future. But since none commented on the xml solution I'm still curious of how well or bad this could work.

Background story and goal: I'm wo开发者_如何转开发rking on a script to send files (documents) from server A via ftp to web server B. Then on B I want the asp.net web page to present the name of all the files (somehow visually informing the user of what files are in what folder) and provide a link to that file.

My thought was to have the on A script generate an xml file containing the file and folder structure and upload it together with the files to B. Then using the XmlDataSource binding the xml file on B.

I see a number of issues here like how would one make this work for folders? Also there is the issue of concurrency. How do I ensure that the website doesn't use the new xml file to map the old files or the old xml to map the new files. Would creating a file on the ftp and have asp.net look for it before binding the XmlDataSource be an acceptable solution (such as if it detected the file it show a message like “Please wait while website content is being updated”) and having the script removing the lockfile when the commit is completed?


The simple is the xml layout.

<folder name="c:">
<file name="image.jpg" />
<folder name="users">
  <folder name="you">
    <file name="something.txt" />
  </folder>
  <folder name="me">
    <file name="something.txt" />
  </folder>
</folder>
</folder>

You then decided how to create that xml tree and what you need to communicate it back and forth to the server. You don't have to start at the drive letter, you can have any folder be the root node. Only folder's have files and other folders.

It is up to you to keep the two halves (client/server) concurrent/up to date. One suggestion is anytime a client connects to the server is create the xml tree fresh, so it at least starts up to date.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜