?
Solved

VBScript does not work in Global.asa

Posted on 2006-11-29
10
Medium Priority
?
555 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
Industry Leaders: 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 180 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 195 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:   The Exchange of informatio…
I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Suggested Courses

752 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