我正在用经典的ASP (在Windows上)编写一个导航系统。我需要一种基于调用脚本的动态包含导航文件的方法。我提出了以下代码,其中包括位于调用脚本文件夹中的nav.inc,以允许不同的文件夹具有不同的导航功能。
这在我的Windows测试机器上工作得很好,但当我部署到Windows时就不行了。代码和错误如下所示。如果有人能提供周围的工作或任何反馈,这将是很好的。谢谢
代码:
<%
'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
%>错误:
Microsoft VBScript运行时错误:“800a01b6” 描述:对象不支持此属性或方法:“Server.CreateObject”
如果我将代码更改为Set fs=CreateObject("Scripting.FileSystemObject"),则会得到以下错误:
Microsoft VBScript运行时错误:“800a01ad” 描述: ActiveX组件无法创建对象:“Scripting.FileSystemObject”
更新我刚刚尝试直接运行Server.Execute,这也失败了。看起来我没有对Server对象的任何访问权。这里也有什么工作要做吗?
发布于 2010-04-08 12:29:34
Windows不支持CreateObject和Execute。
<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来源
https://stackoverflow.com/questions/2598967
复制相似问题