Archived Forum Post

Index of archived forum posts

Question:

CK FileAccess false postive

Oct 10 '14 at 13:16

I think I found a false positive bug in ckFielAccess for ActiveX.

When the IIS user does not have access to a shared folder on another machine the result of .FileExists(x) is always 1.

-Erik

Code:

Set oFA = Server.CreateObject("Chilkat_9_5_0.FileAccess")

If oFA.FileExists(c("folder_path") & inFileName) = 1 Then
  FullPath = c("folder_path") & inFileName
ElseIf oFA.FileExists(c("folder_path_old") & inFileName) = 1 Then
  FullPath = c("folder_path_old") & inFileName
End If

Response.Write oFA.LastErrorHTML
ChilkatLog:

FileExists:
    DllDate: Aug 1 2014
    ChilkatVersion: 9.5.0.43
    UnlockPrefix: NONE
    Username: BUTCHER:IUSR_BUTCHER
    Architecture: Little Endian; 32-bit
    Language: ActiveX
    VerboseLogging: 1
    filename: \\mathis\shared\ecertsfiles\accounting\xml\abc.pdf

When I switch the IIS user an account that does have access to shared resource I get the expected result.

ChilkatLog:

FileExists:

    DllDate: Aug 1 2014
    ChilkatVersion: 9.5.0.43
    UnlockPrefix: NONE
    Username: BUTCHER:internetuser
    Architecture: Little Endian; 32-bit
    Language: ActiveX
    VerboseLogging: 1
    filename: \\mathis\shared\ecertsfiles\accounting\xml\abc.pdf
    WindowsError: The system cannot find the file specified.

Answer

The problem is that FileExists returns true/false, but there is a 3rd possibility -- that it is impossible to even check to see if the file exists. That's what is happening here. I'm going to add a new method named "FileExists3" which returns an integer value:

-1: Unable to check because of permissions or some other error.
0: Does not exist for sure.
1: Exists for sure.


Answer

Here's a new build with the FileExists3 method:

32-bit Download: http://www.chilkatsoft.com/download/preRelease/ChilkatAx-9.5.0-win32.zip

64-bit Download: http://www.chilkatsoft.com/download/preRelease/ChilkatAx-9.5.0-x64.zip