issues with FileSystemObject and date properties on win server 2016 / IIS 10RSS

5 replies

Last post Jul 09, 2019 05:50 AM by Able

  • issues with FileSystemObject and date properties on win server 2016 / IIS 10

    Jul 03, 2019 05:32 PM|fdumusois|LINK

    Hi

    when running this code :

    <%
    dim ObjFSO
    set  ObjFSO = Server.CreateObject("Scripting.FileSystemObject")
    response.write ObjFSO.GetFolder("C:\etocomm_appli\sftp\test.txt").DateLastModified
    %>

    I get a "path not found error".

    Replace property by name, size, path, etc. No problem. Problems occur just with date properties (lastaccessed,datecreated), on folders or files.

    IUSR has change rights on this path

    Any idea or solution ?

  • Re: issues with FileSystemObject and date properties on win server 2016 / IIS 10

    Jul 04, 2019 03:05 AM|Able|LINK

    Hi fdumusois,

    According to your code,since you have make sure the path is correct ,I suggest that you could try to modify as this:

    <%
    dim fs,f
    set fs=Server.CreateObject("Scripting.FileSystemObject")
    set f=fs.GetFile("c:\test.txt")
    Response.Write("File last modified on: ")
    Response.Write(f.DateLastModified)
    set f=nothing
    set fs=nothing
    %>
    

    Best Regards

    Able

    Please remember to click "Mark as Answer" the responses that resolved your issue.
    If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.
  • Re: issues with FileSystemObject and date properties on win server 2016 / IIS 10

    Jul 04, 2019 09:55 AM|fdumusois|LINK

    Thank you for your answer

    The example I gave yesterday was not good, now that I read it.

    I use getfolder to get a file, it won't work anyway

    So I've update the code and it looks to be related to NTFS permissions in a way I don't really understand.

    <%
    dim ObjFSO, folder1, folder2
    
    set  ObjFSO = Server.CreateObject("Scripting.FileSystemObject")
    set folder1 = ObjFSO.GetFolder("C:\etocomm_appli\sftp\web")
    response.write folder1.DateLastModified &"<br>"
    set folder2 = ObjFSO.GetFolder("C:\etocomm_appli\sftp")
    response.write folder2.Path&"<br>"
    response.write folder2.DateLastModified&"<br>"
    set folder2 = Nothing
    set folder1 = Nothing
    set  ObjFSO = Nothing
    %>

    So if I give read rights to IUSR on the parent folder ( C:\etocomm_appli\)I can get the date properties of the child folder (C:\etocomm_appli\sftp)

    the result of the code:

    13/09/2018 16:27:03
    C:\etocomm_appli\sftp
    03/07/2019 19:26:58

    If IUSR has no rights ont the parent folder but has still the change rights on the folder itself (C:\etocomm_appli\sftp), I can't get any date properties, and I get the "path not found" error (in french there). The preceding line, where I get the path property, does not generate an error.

    the result of the code with no right for IUSR on C:\etocomm_appli\:

    13/09/2018 16:27:03
    C:\etocomm_appli\sftp
    
    Erreur d'exécution Microsoft VBScript erreur '800a004c'
    
    Chemin d'accès introuvable
    
    /dynamic/ajax/FStree_JSONtest.asp, ligne 9 

    Isn'it a weird behaviour ? Is it normal to be able to access most of the folder properties, and get a "file not found" error on date properties ? Simply because IUSR has no rights on the parent folder ?

  • Re: issues with FileSystemObject and date properties on win server 2016 / IIS 10

    Jul 05, 2019 08:15 AM|Able|LINK

    Hi fdumusois,

    According  to your description,it's strange that  it shows 404 error.I have created a site to test and it shows 401.3 permission error if you just disable iusr for main folder. If you want to visit the subfolder ,it is obvious that you should visit main folder firstly.

    404 error means application couldn't find file. So I doubt that you make some change in your folder permission of the web application.Could you please show me how you add permission in your  folder security tag? 

    Best Regards

    Able

    Please remember to click "Mark as Answer" the responses that resolved your issue.
    If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.
  • Re: issues with FileSystemObject and date properties on win server 2016 / IIS 10

    Jul 08, 2019 03:32 PM|fdumusois|LINK

    Hi Able

    I don't know why you're talking about 404 html error.

    I get a 500 html error, which means execution error, and the text is shown above, but in french.

    I wrote too fast again last time : it's not a "file not found" error that I get but a "path not found", and I get that only when I try to access date properties of the folder with FSO.

    It occurs only when IUSR has no right on the parent folder of the folder for which I try to get the date properties.On the folder itself, IUSR have "change" rights

    The other properties like name, size, path do not generate "path not found error" for the same folder in the same configuration.

  • Re: issues with FileSystemObject and date properties on win server 2016 / IIS 10

    Jul 09, 2019 05:50 AM|Able|LINK

    Hi fdumusois,

    Sorry for my misunderstanding,firstly 500 error shows it has error inside server.Many reasons includes permissions will cause this error.

    Then it is obvious that  IUSR would will fetch the folder before he get the folder which you want to get the properties.However it doesn't have the permission for IUSR ,so it will leads error for permission and as a result it will cause 500 error.

    Best Regards

    Able

    Please remember to click "Mark as Answer" the responses that resolved your issue.
    If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.