dubisteam
asked on
VBScript does not work in Global.asa
Hi All,
I have a VBScript that retrieves user name of person logged into computer. This code works when embedded in a asp page but doesnt seem to work when i put the code into a Global.asa. Has anyone any suggestions ??
I have a VBScript that retrieves user name of person logged into computer. This code works when embedded in a asp page but doesnt seem to work when i put the code into a Global.asa. Has anyone any suggestions ??
Can you post your code?
ASKER
-------------------Global. asa------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------
<SCRIPT LANGUAGE="VBScript" RUNAT="Server">
Sub Application_OnStart
End Sub
Sub Application_OnEnd
End Sub
Sub Session_OnStart
Session("Test") = Now()
Dim Shell
Dim strUser
set Shell = createobject("wscript.shel l")
set env = shell.environment("process ")
Session("user_id") = env("username")
End Sub
Sub Session_OnEnd
End Sub
</SCRIPT>
<SCRIPT LANGUAGE="VBScript" RUNAT="Server">
Sub Application_OnStart
End Sub
Sub Application_OnEnd
End Sub
Sub Session_OnStart
Session("Test") = Now()
Dim Shell
Dim strUser
set Shell = createobject("wscript.shel
set env = shell.environment("process
Session("user_id") = env("username")
End Sub
Sub Session_OnEnd
End Sub
</SCRIPT>
Maybe this:
set Shell = WScript.createobject("wscr ipt.shell" )
set Shell = WScript.createobject("wscr
ASKER
An error appeared saying "Object required: 'WScript' ". Any Ideas ??
hmm, not yet. I was referncing this page: http://www.winguides.com/scripting/reference.php?id=109
Maybe server.createobject...
ASKER
Yeah, tried server.createobject and it worked but script doesnt seem to be working. Session("user_id") is blank. Don't know why
It may be because you are looking for that session var when the session runs the first time... Before you've set that var...
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.