I am writing a navigation system in classic ASP (on Windows CE). I require a way to dynamically include navigation files based on the calling script. I have come up with the following code that includes nav.inc that is located in the folder of the calling script to allow different folders to have different navigational features.
This works fine on my Windows test machine but NOT when I deploy to Windows CE. The code and error is shown below. If anyone can provide a work around or any feedback that would be great. Thanks
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: Object doesn't support this property or method: 'Server.CreateObject'
If I alter the code to just say Set fs=CreateObject("Scripting.FileSystemObject")
I get the following error:
Microsoft VBScript runtime error: '800a01ad'
Description: ActiveX component can't create object: 'Scripting.FileSystemObject'
Update I have just tried running Server.Execute directly and this fails too. It looks like I do not have any access to the Server object. Is there any work around for this as well?