Solved

VBScript does not work in Global.asa

Posted on 2006-11-29
10
554 Views
Last Modified: 2007-12-19
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 ??
0
Comment
Question by:dubisteam
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 3
10 Comments
 
LVL 18

Expert Comment

by:SquareHead
ID: 18036617
Can you post your code?
0
 

Author Comment

by:dubisteam
ID: 18036953
-------------------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>
0
 
LVL 18

Expert Comment

by:SquareHead
ID: 18037069
Maybe this:

set Shell = WScript.createobject("wscript.shell")
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:dubisteam
ID: 18037447
An error appeared saying "Object required: 'WScript' ". Any Ideas ??
0
 
LVL 18

Expert Comment

by:SquareHead
ID: 18037475
hmm, not yet. I was referncing this page: http://www.winguides.com/scripting/reference.php?id=109
0
 
LVL 18

Expert Comment

by:SquareHead
ID: 18037482
Maybe server.createobject...
0
 

Author Comment

by:dubisteam
ID: 18037520
Yeah, tried server.createobject and it worked but script doesnt seem to be working. Session("user_id") is blank. Don't know why
0
 
LVL 18

Expert Comment

by:SquareHead
ID: 18037552
It may be because you are looking for that session var when the session runs the first time... Before you've set that var...
0
 
LVL 18

Assisted Solution

by:SquareHead
SquareHead earned 60 total points
ID: 18037599
Oh I see what you mean, disregard my last comment. You mean the env("username") is empty I guess, and not setting a value in the session var...
0
 
LVL 15

Accepted Solution

by:
joeposter649 earned 65 total points
ID: 18039021
You're trying to get an environment variable called username on the web server and assign it to a session varibable called user_id?  Wouldn't every user get the same user_id?
0

Featured Post

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
Come and listen to Percona CEO Peter Zaitsev discuss what’s new in Percona open source software, including Percona Server for MySQL (https://www.percona.com/software/mysql-database/percona-server) and MongoDB (https://www.percona.com/software/mongo-…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…

696 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question