ActiveXObject创建错误“自动化服务器无法创建对象“ [英] ActiveXObject creation error " Automation server can't create object"
问题描述
我有一个非常简单的JavaScript代码,
I have a very simple javascript code,
<script language="javascript">
function RunExe()
{
w = new ActiveXObject("WScript.Shell");
w.run('notepad.exe');
return true;
}
</script>
<form id="form1">
<div>
<input type="button" value="Run" onclick="return RunExe()" />
</div>
</form>
如果我在普通的html中保存并运行,那么创建一个运行notepad.exe的activeX对象它在IE中,它可以正常打开记事本,但如果我将其插入到aspx页面并运行它,它将给出一个名为自动化服务器无法创建对象的错误,我google了很多次,但是IE安全性我已经做过的事情,我认为它是ASP或IIS中的一些我无法弄清楚的东西。
Which create an activeX object to run notepad.exe, if I save this in a plain html and run it in the IE, it works fine opening up the notepad, but if I insert this into a aspx page and run it, it will give an error called "Automation server can't create object", I googled it many times, but the IE security things I have already done and I think it's something in ASP or IIS which I couldn't figure out.
您的建议和输入非常值得注意。
Your suggestions and inputs are highly appreciable.
Thanx
推荐答案
那么你无法从记事本中运行代码,这意味着你正在从文件系统中打开页面。 aka c:/foo/bar/hello.html
Well you can not run code from notepad so that means you are opening up the page from the file system. aka c:/foo/bar/hello.html
当您从asp.net页面运行代码时,您将从localhost运行它。又名 http:// loalhost:1234 / assdf.html
When you run the code from the asp.net page, you are running it from localhost. aka http://loalhost:1234/assdf.html
每个都在IE上的不同安全区域中运行。
Each of these run in different security zones on IE.
这篇关于ActiveXObject创建错误“自动化服务器无法创建对象“的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!