Link to home
Start Free TrialLog in
Avatar of dubisteam
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 ??
Avatar of SquareHead
SquareHead

Can you post your code?
Avatar of dubisteam

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.shell")
set env = shell.environment("process")
Session("user_id") = env("username")

End Sub


Sub Session_OnEnd


End Sub

</SCRIPT>
Maybe this:

set Shell = WScript.createobject("wscript.shell")
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...
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
Avatar of SquareHead
SquareHead

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial