Recommended: ASP example: Detailed explanation of counter program Active Server Pager (dynamic server homepage, referred to as ASP), can easily realize the page counter function by reading and writing server files, combining script language (VBscript or Jscript) and html code. The popular ASP textbooks and ASP tutorials on the Internet are discussed
Enable FSO permissions and execute regsvr32.exe scrrun.dll during start-run. If you want to turn off FSO permissions, add /u parameter to the above command. Key value location in the registry: HKEY_CLASS_BOOT/FSO. There is a method in FSO that is CreateFolder, but this method can only create a new folder when the previous level folder exists, so I wrote an automatic creation. Multi-level folder functions are very convenient to use in generating static pages. function:
| The following is the quoted content: ' -------------------------------- ' Automatically create the specified multi-level folder ' strPath is an absolute path Function AutoCreateFolder(strPath) ' As Boolean On Error Resume Next Dim astrPath, ulngPath, i, strTmpPath Dim objFSO If InStr(strPath, /) <=0 Or InStr(strPath, :) <= 0 Then AutoCreateFolder = False Exit Function End If Set objFSO = Server.CreateObject(Scripting.FileSystemObject) If objFSO.FolderExists(strPath) Then AutoCreateFolder = True Exit Function End If astPath = Split(strPath, /) ulngPath = UBound(astPath) strTmpPath = For i = 0 To ulngPath strTmpPath = strTmpPath & astrPath(i) & / If Not objFSO.FolderExists(strTmpPath) Then ' Create objFSO.CreateFolder(strTmpPath) End If Next Set objFSO = Nothing If Err = 0 Then AutoCreateFolder = True Else AutoCreateFolder = False End If End Function |
Calling method:
| The following is the quoted content: MyPath = C:/a/b/c/ If AutoCreateFolder(MyPath) Then Response.Write Create a folder successfully Else Response.Write Failed to create folder End If |
Share: ASP instance learning: function that randomly generates file names The following is the quoted content: <html> <meta http-equiv=Refresh content=2> <!-- Place this