Server.CreateObject 的替代方案
我正在用经典 ASP(在 Windows CE 上)编写一个导航系统。 我需要一种根据调用脚本动态包含导航文件的方法。 我提出了以下代码,其中包含位于调用脚本的文件夹中的 nav.inc,以允许不同的文件夹具有不同的导航功能。
这在我的 Windows 测试机上运行良好,但在我部署到 Windows CE 时则不然。代码和错误如下所示。如果有人可以提供解决方法或任何反馈,那就太好了。感谢
代码:
<%
'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'
描述:对象不支持 这个属性或方法: '服务器.CreateObject'
如果我将代码更改为仅显示 Set fs=CreateObject("Scripting.FileSystemObject")
我收到以下错误:
Microsoft VBScript 运行时错误: '800a01ad'
描述:ActiveX组件不能 创建对象: '脚本.FileSystemObject'
更新 我刚刚尝试直接运行 Server.Execute,但也失败了。看来我无权访问服务器对象。有没有解决这个问题的方法?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Windows CE 不支持
CreateObject
和Execute
。也不支持
来源
CreateObject
andExecute
are not supported in Windows CE.The
<OBJECT>
tag is not supported also, so, you are out of luck, sorry.Source