Alternative Server.CreateObject

I am writing a navigation system in classic ASP (on Windows CE). I need a way to dynamically include navigation files based on the calling script. I came up with the following code, which includes nav.inc, which is in the folder of the calling script, to allow different folders to have different navigation functions.

This works fine on my Windows test machine, but NOT when deploying to Windows CE. Code and error are shown below. If someone can provide work or any feedback, that would be great. Thanks

the code:

<% 
   'Get path name
   Dim i
   fullname = Request.ServerVariables("SCRIPT_NAME")
   my_array=split(fullname,"/")
   fname=my_array(ubound(my_array))
   fname = ""

   For i = 0 to ubound(my_array) - 1
    fname = fname & my_array(i) & "/"
   Next

   fname = fname & "nav.inc"

   Set fs=Server.CreateObject("Scripting.FileSystemObject")

   If (fs.FileExists(Server.MapPath(fname)))=true Then
    Server.Execute(fname)
   End If
  %>

Error:

Microsoft VBScript runtime error: '800a01b6'

Description: The object does not support this property or method: 'Server.CreateObject'

If I change the code, I just say Set fs=CreateObject("Scripting.FileSystemObject"), I get the following error:

Microsoft VBScript: '800a01ad'

: ActiveX : 'Scripting.FileSystemObject'

Server.Execute , . , Server. ?

+3
1

CreateObject Execute Windows CE.
<OBJECT> , , .

Server Object Implementation
---------------------------

The Server object provides access to methods and properties on the server. 
Most of these methods and properties serve as utility functions.

Server method  Windows CE implementation
-----------------------------------------
CreateObject   Not supported
Execute        Not supported
GetLastError   Not supported
HTMLEncode     Not supported
MapPath        Fully supported
ScriptTimeout  Not supported
Transfer       Not supported
URLEncode      Fully supported

+4

Source: https://habr.com/ru/post/1740292/


All Articles