The magic of FSO in ASP-What FSO cannot do

Source: Internet
Author: User

Author: Gan jiping;

FSO does have some weaknesses-for example, it is difficult to process binary files, including Word documents, many graphical files and other files. However, you can still operate these files in other ways-move them, delete them, and so on. What you cannot do is to open or write them.

Another restriction is the file length. When you read and write some content immediately, all information is stored in the memory. The more content, the larger the memory consumption. This slows down every job. Therefore, if you need to operate a very large file, or a large number of small files, consider splitting the file into small blocks and frequently clearing the memory. Integrating applications into COM Object components can greatly increase the program speed.

Similarly, you cannot use FSO to manage permissions and attributes of files and folders. A good way to perform security encryption is to set the aforementioned message book file to read-only, set it to writable when necessary, and then modify it back. This method is often used in CGI and Perl, but unfortunately there is no satisfactory method to implement it with FSO.

What else can FSO be used?

There are many great features in FSO, but many people don't realize it. These features are often discovered only when you feel that it is difficult to do something. At this time, you often have to lament that it would be nice if I knew this method!

The following lists some of the functions that are not commonly used but are cool:

FSO features rarely known

GetSpecialFolder Method returns the path of the specific Windows Folder: Windows installation directory; Windows System directory; Windows temporary directory FSO. GetSpecialFolder ([0, 1, or 2])

GetTempName Method returns a randomly generated file or directory name, which is used when temporary data needs to be stored.

GetAbsolutePathName Method returns the absolute path of the folder (similar to Server. MapPath ).

For example, FSO. GetAbsolutePathName ("region") returns a result similar to the following: "c: mydocsmyfolder egion"

GetExtensionName Method returns the extension of the last part of the path.

(For example, FSO. GetExtensionName ("c: docs est.txt") will return txt)

GetBaseName and GetParentFolder Methods return the parent folder of the last part of the path

(For example, FSO. GetParentFolder ("c: docsmydocs") will return 'docs ')

Drives Property returns a collection of all available local Drives, used to create a resource browser-like user interface.

When using the above functions, it is best to establish the error handling code. If the required parameter does not exist, it will produce troublesome information.

Summary

As we have seen, FSO is very useful. Here we are only introducing the tip of the iceberg. You can use FSO to build powerful applications and simply complete many tasks.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.