In PHP I am using this
if(!f || !f2)
Now I am converting this code into ASP like this
If Not f OR Not f2 Then
but it gives me an error:
Error Type:
Microsoft VBScript runtime (0x800A01B6)
Object doesn't support this property or method
What I can do now?
Because f
and f2
are objects, I think the ASP is assuming that they have default properties which you're trying to test in
If Not f OR Not f2 Then
which is why you get that error message (for example if the default property was Name
, you'd actually be testing If Not f.Name OR Not f2.Name Then
).
What you probably want to do is test to see if they are invalid objects, which you can do by
If (f Is Nothing) OR (f2 Is Nothing) Then
Looks like what you really need is to check whether those files exist or not - classic ASP has different logic than PHP.
So try using this code instead:
Dim fp1, f, f2
Dim vid, vkey
Dim enc, enc1, enc2
set fp1 = Server.CreateObject("Scripting.FileSystemObject")
If fp1.FileExists(vid_file) And fp1.FileExists(vkey_file) Then
set f = fp1.OpenTextFile(vid_file, 1, true)
set f2=fp1.OpenTextFile(vkey_file, 1, true)
vid = Trim(f.ReadLine)
vkey = Trim(f2.ReadLine)
f.Close
f2.Close
Set f = Nothing
Set f2 = Nothing
enc1 = hex_sha1(vid)
enc2 = hex_sha1(vkey)
enc = enc1 & enc2
Else
Response.Write "Vendor authentication failed."
End If
User contributions licensed under CC BY-SA 3.0