可以从.vbs文件执行任务,但不能从.asp文件执行任务!为什么? [英] Can perform task from a .vbs file but not from an .asp file! Why?

查看:56
本文介绍了可以从.vbs文件执行任务,但不能从.asp文件执行任务!为什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




我之前有一个关于从

ASP运行DLL文件的问题。它不适合我。 Bo错误返回,没什么,只是一个空的
字符串(当它应该没有为空时)。我创建了一个.vbs文件并将

放在与Web上的.asp文件相同的目录中。完全相同的代码。

运行正常。我称之为asp文件后,它仍然无效。会不会有人知道为什么.asp无法运行这个dll?


有问题的dll会在同一个文件夹中创建一个文件夹目录为

调用文件。我认为它可能是一个权限的东西,但在创建

a新的dll文件来测试创建文件夹之后,它没有问题这样做


我被困住了我不知道我还能做些什么才能从asp开始运行


谢谢


Leo

Hi

I had asekd previously a question qith regards to running a DLL file from
ASP. It was not running for me. Bo error returned, nothing, Just an empty
string (when it should have not been empty). I created a .vbs file and put
it in the same directory as the .asp file on the web. The same exact code.
It runs fine. Soon as I call the asp file, it still does nothing. Would
anyone have an idea as to why the .asp has no ability to run this dll?

The dll in question will create a folder within the same directory as the
calling file. I thought it could be a permissions thing, but after creating
a new dll file to test creating folders, it had no problem doing so

I am stuck as I am not sure what else I could do to make this run from asp

Thanks

Leo

推荐答案

我应该稍微澄清这一点


''----------------- -----从ASP和VBS调用的VB DLL代码

文件-----------------------

私有声明函数DmfDemoEncrypt Lib" C:\Program

Files \Samples \Simple\email_encrypt.dll" (ByVal email As String,ByVal s As

String)As String


Public strEmails As String

Public strEncryptThisString As String

Public strEncryptedData As String


Public Function EncryptData(ByVal emailaddresses As String,ByVal

DataToEncrypt As String)As String


strEncryptThisString = DataToEncrypt

strEmails = emailaddresses

strEncryptedData =(DmfDemoEncrypt(strEmails,

strEncryptThisString))



EncryptData = strEncryptedData


结束功能

''---- ------------------------ END VB

CODE --------------- -----------------------------

vbs文件的代码


''------------------ VBS CODE(作品)--------------- -


选项明确


Dim WshShell,fso,cd,objRSServer,strEmails,strAll


设置WshShell = WScript.CreateObje ct(" WScript.Shell")

设置fso = CreateObject(" Scripting.FileSystemObject")

设置objRSServer = CreateObject(" Encrypt.clsEncryptData")


strEmails =&em; em **** @ email.com,em **** @ email.com"


cd =" ;这是加密的电子邮件测试


strAll = objRSServer.EncryptData(strEmails,cd)


如果strAll<> ""然后


Msgbox strAll

Else


msgbox"没有返回"

结束如果


''清理。

设置WshShell =没什么

设置fso =没什么


''---------------------------------- END ----- ------------------

ASP文件的代码(不起作用)


''---- ASP代码------------------------


<%


设置objServer = Server.CreateObject(" Encrypt.clsEncryptData")

strEmails =" em **** @ email .com,em **** @ email.com"

cd ="这是一个测试 ''请求(" Body")''"这是加密的电子邮件

test"

strAll = objServer.EncryptData(strEmails,cd)


response.write strAll


%>


我甚至尝试手动指定<! - #include file =" Encrypt.dll" - >

无效


VB包装器调用实际加密数据的C ++ dll位于Windows目录中某处的
。一旦调用它就会在

中创建一个文件夹,该文件夹与调用文件(在本例中为ASP或VBS)名为

store的目录相同,其中存储了一些加密密钥,证书等....

所以我的问题是:为什么我可以从VB或VBS文件运行这个VB DLL,但

不是ASP?


它与权限有什么关系吗?





" ;利奥" <无** @ none.com>在消息中写道

news:ei *************** @ tk2msftngp13.phx.gbl ...
I should crlarify this a bit maybe

''----------------------Code for the VB DLL called from the ASP and VBS
files -----------------------
Private Declare Function DmfDemoEncrypt Lib "C:\Program
Files\Samples\Simple\email_encrypt.dll" (ByVal email As String, ByVal s As
String) As String

Public strEmails As String
Public strEncryptThisString As String
Public strEncryptedData As String

Public Function EncryptData(ByVal emailaddresses As String, ByVal
DataToEncrypt As String) As String

strEncryptThisString = DataToEncrypt
strEmails = emailaddresses
strEncryptedData = (DmfDemoEncrypt(strEmails,
strEncryptThisString))


EncryptData = strEncryptedData


End Function
''---------------------------- END VB
CODE--------------------------------------------
Code for the vbs file

''------------------ VBS CODE (works) -----------------------

Option Explicit


Dim WshShell,fso,cd,objRSServer,strEmails,strAll

Set WshShell = WScript.CreateObject("WScript.Shell")
Set fso = CreateObject("Scripting.FileSystemObject")
Set objRSServer = CreateObject("Encrypt.clsEncryptData")

strEmails = "em****@email.com,em****@email.com"

cd = "this is encrypted email test"

strAll = objRSServer.EncryptData(strEmails, cd)

If strAll <> "" then

Msgbox strAll
Else

msgbox "Nothing returned"
End if


''Cleanup.
Set WshShell = Nothing
Set fso = Nothing

''---------------------------------- END -----------------------
code for the ASP file (doesn''t work )

''------------ ASP CODE ------------------------

<%

Set objServer = Server.CreateObject("Encrypt.clsEncryptData")
strEmails = "em****@email.com,em****@email.com"
cd = "this is a test" ''Request("Body") ''"this is encrypted email
test"
strAll = objServer.EncryptData(strEmails,cd)

response.write strAll

%>

I even tried to manually specify a <!-- #include file="Encrypt.dll" --> to
no avail

The C++ dll which the VB wrapper calls to actually encrypt the data sits
somewhere in the Windows directory. Once it is called it creates a folder in
the same directory as the calling file (ASP, or VBS in this case) called
store, where it stores some encryption keys , certificates etc....
So my question would be: why can I run this VB DLL from VB or VBS files, but
not ASP?

Could it have anything to do with permissions?






"Leo" <no**@none.com> wrote in message
news:ei***************@tk2msftngp13.phx.gbl...

我之前有一个关于从
ASP运行DLL文件的问题。它不适合我。 Bo错误返回,没什么,只是一个空的
字符串(当它应该没有为空时)。我创建了一个.vbs文件,并将它放在与Web上的.asp文件相同的目录中。完全相同的代码。
运行正常。我称之为asp文件后,它仍然无效。是否有人知道为什么.asp没有能力运行这个dll?

有问题的dll将在与
调用相同的目录中创建一个文件夹文件。我认为它可能是一个权限的东西,但在
创建一个新的dll文件来测试创建文件夹后,它没有问题这样做

我被卡住,因为我不知道还有什么我可以做到这一点来自asp

感谢

Hi

I had asekd previously a question qith regards to running a DLL file from
ASP. It was not running for me. Bo error returned, nothing, Just an empty
string (when it should have not been empty). I created a .vbs file and put
it in the same directory as the .asp file on the web. The same exact code.
It runs fine. Soon as I call the asp file, it still does nothing. Would
anyone have an idea as to why the .asp has no ability to run this dll?

The dll in question will create a folder within the same directory as the
calling file. I thought it could be a permissions thing, but after creating a new dll file to test creating folders, it had no problem doing so

I am stuck as I am not sure what else I could do to make this run from asp

Thanks

Leo



" ;利奥" <无** @ none.com>在留言中写道

新闻:%2 **************** @ tk2msftngp13.phx.gbl ...

:我应该夸大一点这可能是



:''---------------------- Code for从ASP和VBS调用的VB DLL

:files -----------------------





:私有声明函数DmfDemoEncrypt Lib" C:\Program

:Files \Samples \Simple\email_encrypt的.dll" (ByVal email As String,ByVal s As

:String)As String



:公共strEmails As String

:Public strEncryptThisString As String

:Public strEncryptedData As String







:Public Function EncryptData(ByVal emailaddresses As String,ByVal

:DataToEncrypt As String)As String







:strEncryptThisString = DataToEncrypt

:strEmails = emailaddresses

:strEncryptedData =(DmfDemoEncrypt(strEmails,

:strEncryptThisString))









:EncryptData = strEncryptedData













:结束功能

:''---------------- ------------结束VB

:CODE -------------------------- ------------------





:vbs文件的代码



:''------ ------------ VBS CODE(作品)-----------------------



:选项明确









:Dim WshShell,fso,cd,objRSServer,strEmails,strAll



:设置WshShell = WScript.CreateObject(" WScript.Shell")

:设置fso = CreateObject(" Scripting.FileSystemObject")





:设置objRSServer = CreateObject(" Encrypt.clsEncryptData")



:strEmails =" em **** @ email.com,em **** @ email.com" ;



:cd ="这是加密电子邮件测试"







:strAll = objRSServer.EncryptData(strEmails,cd)



:如果strAll<> ""然后



:Msgbox strAll

:否则



:msgbox 没有返回

:结束如果









:''清理。

:设置WshShell = Nothing

:设置fso = Nothing



:''---------------------------------- END ---- -------------------





:ASP的代码文件(不工作)



:''------------ ASP代码-------- ----------------



:<%







:设置objServer = Server.CreateObject(" Encrypt.clsEncryptData")





:strEmails =&em; em **** @ email.com,em **** @ email.com"

:cd =" ;这是一个测试 ''请求(正文)''这是加密的电子邮件

:test"





:strAll = objServer.EncryptData(strEmails,cd)



:response.write strAll



:%>



:我甚至尝试手动指定<! - #include file =" Encrypt.dll" - >

:无效



:VB包装器调用实际加密数据的C ++ dll

:Windows目录中的某个位置。一旦调用它就会在

中创建一个文件夹

:与调用文件相同的目录(在本例中为ASP或VBS)名为

:存储,它存储一些加密密钥,证书等....





:所以我的问题是:为什么我可以从VB或VBS文件运行这个VB DLL,

但是

:不是ASP?



:它与权限有什么关系吗?









































: "利奥" <无** @ none.com>在消息中写道

:news:ei *************** @ tk2msftngp13.phx.gbl ...

:>嗨

:>

:>我之前有一个关于运行DLL文件的问题

来自

:> ASP。它不适合我。 Bo错误返回,没有,只是一个



:> string(当它应该不是空的时候)。我创建了一个.vbs文件和

put

:>它与Web上的.asp文件位于同一目录中。同样的确定

代码。

:>它运行正常。我称之为asp文件后,它仍然无效。将

:>任何人都知道为什么.asp无法运行这个dll?

:>

:>有问题的dll将在同一目录中创建一个文件夹



:>调用文件。我认为它可能是一个权限的东西,但在

之后:创建

:>一个新的dll文件来测试创建文件夹,它没有问题这样做

:>

:>我被困了,因为我不知道我还能做些什么来使这个运行起来

asp


该文件可能不会暴露给正在使用的帐户。如果您支持匿名用户,那么IUSR_COMPUTERNAME需要RX权利。


-

Roland Hall
/ *这些信息的分发是希望它有用,但

没有任何保证;甚至没有适销性的暗示保证

或特定用途的适用性。 * /

Technet脚本中心 - http:// www .microsoft.com / technet / scriptcenter /

WSH 5.6文档 - http://msdn.microsoft.com/downloads/list/webdev.asp

MSDN Library - http://msdn.microsoft.com/library/default.asp
"Leo" <no**@none.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
:I should crlarify this a bit maybe
:
: ''----------------------Code for the VB DLL called from the ASP and VBS
: files -----------------------
:
:
: Private Declare Function DmfDemoEncrypt Lib "C:\Program
: Files\Samples\Simple\email_encrypt.dll" (ByVal email As String, ByVal s As
: String) As String
:
: Public strEmails As String
: Public strEncryptThisString As String
: Public strEncryptedData As String
:
:
:
: Public Function EncryptData(ByVal emailaddresses As String, ByVal
: DataToEncrypt As String) As String
:
:
:
: strEncryptThisString = DataToEncrypt
: strEmails = emailaddresses
: strEncryptedData = (DmfDemoEncrypt(strEmails,
: strEncryptThisString))
:
:
:
:
: EncryptData = strEncryptedData
:
:
:
:
:
:
: End Function
: ''---------------------------- END VB
: CODE--------------------------------------------
:
:
: Code for the vbs file
:
: ''------------------ VBS CODE (works) -----------------------
:
: Option Explicit
:
:
:
:
: Dim WshShell,fso,cd,objRSServer,strEmails,strAll
:
: Set WshShell = WScript.CreateObject("WScript.Shell")
: Set fso = CreateObject("Scripting.FileSystemObject")
:
:
: Set objRSServer = CreateObject("Encrypt.clsEncryptData")
:
: strEmails = "em****@email.com,em****@email.com"
:
: cd = "this is encrypted email test"
:
:
:
: strAll = objRSServer.EncryptData(strEmails, cd)
:
: If strAll <> "" then
:
: Msgbox strAll
: Else
:
: msgbox "Nothing returned"
: End if
:
:
:
:
: ''Cleanup.
: Set WshShell = Nothing
: Set fso = Nothing
:
: ''---------------------------------- END -----------------------
:
:
: code for the ASP file (doesn''t work )
:
: ''------------ ASP CODE ------------------------
:
: <%
:
:
:
: Set objServer = Server.CreateObject("Encrypt.clsEncryptData")
:
:
: strEmails = "em****@email.com,em****@email.com"
: cd = "this is a test" ''Request("Body") ''"this is encrypted email
: test"
:
:
: strAll = objServer.EncryptData(strEmails,cd)
:
: response.write strAll
:
: %>
:
: I even tried to manually specify a <!-- #include file="Encrypt.dll" --> to
: no avail
:
: The C++ dll which the VB wrapper calls to actually encrypt the data sits
: somewhere in the Windows directory. Once it is called it creates a folder
in
: the same directory as the calling file (ASP, or VBS in this case) called
: store, where it stores some encryption keys , certificates etc....
:
:
: So my question would be: why can I run this VB DLL from VB or VBS files,
but
: not ASP?
:
: Could it have anything to do with permissions?
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
: "Leo" <no**@none.com> wrote in message
: news:ei***************@tk2msftngp13.phx.gbl...
: > Hi
: >
: > I had asekd previously a question qith regards to running a DLL file
from
: > ASP. It was not running for me. Bo error returned, nothing, Just an
empty
: > string (when it should have not been empty). I created a .vbs file and
put
: > it in the same directory as the .asp file on the web. The same exact
code.
: > It runs fine. Soon as I call the asp file, it still does nothing. Would
: > anyone have an idea as to why the .asp has no ability to run this dll?
: >
: > The dll in question will create a folder within the same directory as
the
: > calling file. I thought it could be a permissions thing, but after
: creating
: > a new dll file to test creating folders, it had no problem doing so
: >
: > I am stuck as I am not sure what else I could do to make this run from
asp

The file is probably not exposed to the account being used. If you''re
supporting anonymous users then the IUSR_COMPUTERNAME needs RX rights.

--
Roland Hall
/* This information is distributed in the hope that it will be useful, but
without any warranty; without even the implied warranty of merchantability
or fitness for a particular purpose. */
Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
WSH 5.6 Documentation - http://msdn.microsoft.com/downloads/list/webdev.asp
MSDN Library - http://msdn.microsoft.com/library/default.asp


我一直在搞乱权限。我在机器上给了IUSR完整的

权限...没有什么

" Roland Hall" <没有人@无处>在消息中写道

news:ui **************** @ TK2MSFTNGP09.phx.gbl ...
I have been messing around with the permissions. I gave the IUSR full
permissions on the machine...nothing
"Roland Hall" <nobody@nowhere> wrote in message
news:ui****************@TK2MSFTNGP09.phx.gbl...
" Leo" ; <无** @ none.com>在消息中写道
新闻:%2 **************** @ tk2msftngp13.phx.gbl ...
:我应该对此进行一些澄清/>:
:''----------------------从ASP和VBS调用的VB DLL代码
:files - ----------------------


:私有声明功能DmfDemoEncrypt Lib" C:\Program
:Files \Samples \Simple\email_encrypt.dll" (ByVal email As String,ByVal s
As:String)As String

:公共strEmails As String
:公共strEncryptThisString As String
:Public strEncryptedData As String



:Public Function EncryptData(ByVal emailaddresses As String,ByVal
:DataToEncrypt As String)As String



:strEncryptThisString = DataToEncrypt
:strEmails = emailaddresses
:strEncryptedData =(DmfDemoEncrypt(strEmails,
:strEncryptThisString))




:EncryptData = strEncryptedData






:结束功能
:''----------------------------结束VB
:代码--------------------------------------------


:vbs文件的代码

:''------------------ VBS代码(有效) - ----------------------

:选项明确




:Dim WshShell,fso,cd,objRSServer,strEmails,strAll

:设置WshShell = WScript.CreateObject(& ; WScript.Shell")
:设置fso = CreateObject(" Scripting.FileSystemObject")


:设置objRSServer = CreateObject(" Encrypt.clsEncryptData")

:strEmails =&em; em **** @ email.com,em **** @ email.com"

:cd ="这是加密电子邮件测试



:strAll = objRSServer.EncryptData(strEmails,cd)

:如果strAll<> ""然后

:Msgbox strAll
:其他

:msgbox没有返回
:结束如果




:''清理。
:设置WshShell = Nothing
:设置fso = Nothing

:' ' - - - - - - - - - - - - - - - - - 结束 - - - - - - - ---------


:ASP文件的代码(不起作用)

:'' - ---------- ASP代码------------------------

:<%



:设置objServer = Server.CreateObject(" Encrypt.clsEncryptData")


:strEmails = em **** @ email.com,em **** @ email.com"
:cd ="这是一个测试 ''请求(" Body")''"这是加密的电子邮件
:test"


:strAll = objServer.EncryptData(strEmails,cd)< br:>:
:response.write strAll

:%>

:我甚至尝试手动指定<! - #include文件= QUOT; Encrypt.dll" - >
to:无效

:VB包装器调用实际加密数据的C ++ dll位于Windows目录的某个地方。一旦调用它就会在
中创建一个
文件夹:与调用文件(在本例中为ASP或VBS)相同的目录名为
:store,它存储一些加密密钥,证书等等......


:所以我的问题是:为什么我可以从VB或VBS文件中运行这个VB DLL,
但不是: ASP?

:它与权限有什么关系吗?




















:狮子座 <无** @ none.com>在消息中写道
:news:ei *************** @ tk2msftngp13.phx.gbl ...
:>嗨
:>
:>我之前有一个关于运行DLL文件的问题,来自
:> ASP。它不适合我。 Bo错误返回,没什么,只是一个空的
:> string(当它应该不是空的时候)。我创建了一个.vbs文件并且

:>它与Web上的.asp文件位于同一目录中。同样的确切代码。
:>它运行正常。我称之为asp文件后,它仍然无效。
会:>任何人都知道为什么.asp没有能力运行这个dll?
:>
:>有问题的dll将在同一目录中创建一个文件夹

:>调用文件。我认为它可能是一个权限的东西,但在
之后:创建
:>一个新的dll文件来测试创建文件夹,它没有问题这样做
:>
:>我被困了,因为我不知道我还能做些什么才能使这个运行起来
asp

该文件可能不会暴露给正在使用的帐户。如果您支持匿名用户,那么IUSR_COMPUTERNAME需要RX权利。

-
Roland Hall
/ *此信息的分发是希望它将是有用的,但
没有任何保证;甚至没有适销性的暗示保证
或适合特定用途的适用性。 * /
Technet脚本中心 - http://www.microsoft.com / technet / scriptcenter /
WSH 5.6文档 -
http://msdn.microsoft.com/downloads/list/webdev.asp MSDN Library - http://msdn.microsoft.com/library/default.asp
"Leo" <no**@none.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
:I should crlarify this a bit maybe
:
: ''----------------------Code for the VB DLL called from the ASP and VBS
: files -----------------------
:
:
: Private Declare Function DmfDemoEncrypt Lib "C:\Program
: Files\Samples\Simple\email_encrypt.dll" (ByVal email As String, ByVal s As : String) As String
:
: Public strEmails As String
: Public strEncryptThisString As String
: Public strEncryptedData As String
:
:
:
: Public Function EncryptData(ByVal emailaddresses As String, ByVal
: DataToEncrypt As String) As String
:
:
:
: strEncryptThisString = DataToEncrypt
: strEmails = emailaddresses
: strEncryptedData = (DmfDemoEncrypt(strEmails,
: strEncryptThisString))
:
:
:
:
: EncryptData = strEncryptedData
:
:
:
:
:
:
: End Function
: ''---------------------------- END VB
: CODE--------------------------------------------
:
:
: Code for the vbs file
:
: ''------------------ VBS CODE (works) -----------------------
:
: Option Explicit
:
:
:
:
: Dim WshShell,fso,cd,objRSServer,strEmails,strAll
:
: Set WshShell = WScript.CreateObject("WScript.Shell")
: Set fso = CreateObject("Scripting.FileSystemObject")
:
:
: Set objRSServer = CreateObject("Encrypt.clsEncryptData")
:
: strEmails = "em****@email.com,em****@email.com"
:
: cd = "this is encrypted email test"
:
:
:
: strAll = objRSServer.EncryptData(strEmails, cd)
:
: If strAll <> "" then
:
: Msgbox strAll
: Else
:
: msgbox "Nothing returned"
: End if
:
:
:
:
: ''Cleanup.
: Set WshShell = Nothing
: Set fso = Nothing
:
: ''---------------------------------- END -----------------------
:
:
: code for the ASP file (doesn''t work )
:
: ''------------ ASP CODE ------------------------
:
: <%
:
:
:
: Set objServer = Server.CreateObject("Encrypt.clsEncryptData")
:
:
: strEmails = "em****@email.com,em****@email.com"
: cd = "this is a test" ''Request("Body") ''"this is encrypted email
: test"
:
:
: strAll = objServer.EncryptData(strEmails,cd)
:
: response.write strAll
:
: %>
:
: I even tried to manually specify a <!-- #include file="Encrypt.dll" --> to : no avail
:
: The C++ dll which the VB wrapper calls to actually encrypt the data sits
: somewhere in the Windows directory. Once it is called it creates a folder in
: the same directory as the calling file (ASP, or VBS in this case) called
: store, where it stores some encryption keys , certificates etc....
:
:
: So my question would be: why can I run this VB DLL from VB or VBS files,
but
: not ASP?
:
: Could it have anything to do with permissions?
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
: "Leo" <no**@none.com> wrote in message
: news:ei***************@tk2msftngp13.phx.gbl...
: > Hi
: >
: > I had asekd previously a question qith regards to running a DLL file
from
: > ASP. It was not running for me. Bo error returned, nothing, Just an
empty
: > string (when it should have not been empty). I created a .vbs file and
put
: > it in the same directory as the .asp file on the web. The same exact
code.
: > It runs fine. Soon as I call the asp file, it still does nothing. Would : > anyone have an idea as to why the .asp has no ability to run this dll?
: >
: > The dll in question will create a folder within the same directory as
the
: > calling file. I thought it could be a permissions thing, but after
: creating
: > a new dll file to test creating folders, it had no problem doing so
: >
: > I am stuck as I am not sure what else I could do to make this run from
asp

The file is probably not exposed to the account being used. If you''re
supporting anonymous users then the IUSR_COMPUTERNAME needs RX rights.

--
Roland Hall
/* This information is distributed in the hope that it will be useful, but
without any warranty; without even the implied warranty of merchantability
or fitness for a particular purpose. */
Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
WSH 5.6 Documentation - http://msdn.microsoft.com/downloads/list/webdev.asp MSDN Library - http://msdn.microsoft.com/library/default.asp



这篇关于可以从.vbs文件执行任务,但不能从.asp文件执行任务!为什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆