开发者

Alternative to Server.CreateObject

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?


CreateObject and Execute are not supported in Windows CE.
The <OBJECT> tag is not supported also, so, you are out of luck, sorry.

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

Source

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜