In ASP, the execution of Scripting. FileSystemObject objects and the createFolder ("test") method cannot be implemented.

Source: Internet
Author: User

 

Problem description:

Run OK on my local machine and OK on the Server at the beginning. It won't work if FrontPage Server Extensions (FPSE) 2002 is installed. Now I have uninstalled FPSE. This is the complete code,
dim XMLPathXMLPath= server.mappath("/") & "fdp\"& month(now) & "-" & day(now) & " " & hour(now) & "-" & minute(now) & "-" & second(now)Set fso = CreateObject("Scripting.FileSystemObject")  response.write "<br/>OKK1111111111111" & XMLPathfso.createFolder(XMLPath) response.write "<br/>OKK2222222222222" & XMLPathfso.createFolder(XMLPath & "\configuration")response.write "<br/>OKK33333333333333" & XMLPathXMLPath=XMLPath & "\configuration"fso.createFolder(XMLPath & "\parameter")fso.createFolder(XMLPath & "\wallpapers")fso.createFolder(XMLPath & "\sounds")fso.createFolder(XMLPath & "\sounds\alarms")fso.createFolder(XMLPath & "\sounds\notifications")fso.createFolder(XMLPath & "\sounds\ringtones")fso.createFolder(XMLPath & "\sounds\ui")response.write "<br/>OKK444444444444" & XMLPath
 

Cause and solution:

 

 

In addition, some execution problems occur because

1. Because the Scripting. FileSystemObject object is not registered,

Solution:

Register scrrun. dll again

For example, when the supervisor starts, enter "regsvr32.exe % windir %/system32/scrrun. dll" in "---“runtime", Press enter, and re-register the FSO object.

Test method: We recommend that you use the alicloud probe to test the FileSystemObject component on your current server;

2. Use the error detection mechanism to identify the cause of the problem

On Error Resume Next 'fso. createFolder (XMLPath) Error line content If Err. number <> 0 thenresponse. write "you cuo wu" %> error Number: <% = Err. number %> <br/> error message: <% = Err. description %> <br/> error file: <% = Err. source %> <br/> error line: <% = Err. line %> <br/> <% = Err %> end ifOn Error Goto 0
This can be used to detect errors. For error numbers, see the Description corresponding to ASP Err. Number.
For more information about post-installation articles, see the MSDN article: IIS Question and Answer-January 1, August 2003
 
3. Use the following methods to detect
Function MD(strSysPath)    On Error Resume Next    Dim i    Dim objFSO    Dim arrPath    Dim strNoncePath    MD = True    Set objFSO = Server.Createobject("Scripting.FileSystemObject")    If Not objFSO.FolderExists(strSysPath) Then        arrPath = Split(strSysPath, "\")        strNoncePath = arrPath(0)        For i = 1 To UBound(arrPath)            strNoncePath = strNoncePath & "\" & arrPath(i)            If objFSO.FolderExists(strNoncePath) Then            Else                objFSO.CreateFolder strNoncePath            End If        Next    End If    Set objFSO = Nothing    If Err.Number <> 0 Then MD = False    On Error Goto 0End Function
Sample Code: response. write MD (XMLPath & "\ sounds") 'true indicates success; False indicates failure.
 
Finally, ASP is really outdated ......
 
 
Related Article

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.