我如何在ASP .Net中使用Wscript.shell [英] How do I use Wscript.shell in ASP .Net
问题描述
hello frnds,
我在按钮点击事件中编写了一个简单的asp .net代码,其中应运行xx.cmd。按下文件
(以下是代码)
Partial Class _Default
继承System.Web.UI .Page
受保护的子Button1_Click(ByVal发送者为对象,ByVal e As System.EventArgs)处理Button1.Click
Dim oShell
oShell = Server.CreateObject(" wscript.shell")
oShell.Run("""" C:\sampscripts \ xxxcmd""")
oShell =没什么
结束次级
结束班级
但是没有执行(下面是我得到的消息)
***************************** ********************* ***************************** *****
{&'无法创建组件''wscript.shell''。公寓线程组件只能在<%@ Page aspcompat = true%>的页面上创建。页面指令。}
************************************ ************** ********************************** />
我还需要从上面的代码传递一些参数到xxxx.cmd,我该怎么做....任何帮助都非常感谢....
< br $>
谢谢
Fida
hello frnds,
I have written a simple asp .net code in button click event, in which should run "xx.cmd" file when pressed
(below is the code)
Partial Class _Default
Inherits System.Web.UI.Page
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim oShell
oShell = Server.CreateObject("wscript.shell")
oShell.Run("""C:\sampscripts\xxxx.cmd""")
oShell = Nothing
End Sub
End Class
but its not executing (below is the msg I m getting)
************************************************** **********************************
{"The component ''wscript.shell'' cannot be created. Apartment threaded components can only be created on pages with an <%@ Page aspcompat=true %> page directive."}
************************************************** **********************************
I also need to pass some parameters to the xxxx.cmd from the above code, how do I do this....any help is highly appreciated....
Thanks
Fida
推荐答案
你是否尝试过它所说的并添加了 <%@ Page aspcompat = true%> "到你的页面?
你知道目前,脚本将在服务器上运行而不是在客户端上运行吗?
Have you tried doing what it says and adding the "<%@ Page aspcompat=true %> " to your page?
You are aware that currently, the script will run on the server and not on the client right?
非常感谢Patel
我是一名系统管理员,对.net中的编程不太了解,我没有尝试过<%@ Page aspcompat = true%>这个......你能不能告诉我如何继续这个?
但是,是的,我只知道脚本在服务器上运行而不是在客户端上运行
....
有什么建议吗?
thnx
Thanks very much Patel
I am actaully a sys admin, not much aware of programming in .net, I havent tried <%@ Page aspcompat=true %> this..can you plz suggest me how do I proceed with this?
but, yes, I just know that the script is running on server not on client
....
any suggestions?
thnx
在你的aspx页面中,顶部应该有一个<%@ Page ;声明。检查aspcompat属性并使其成为= true,如果它不存在,请将其添加?
In your aspx page, at the top there should be a "<%@ Page " statement. Check for the "aspcompat" property and make it "=true", if it''s not there, add it in?
这篇关于我如何在ASP .Net中使用Wscript.shell的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!