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
Solved

VBScript does not work in Global.asa

Posted on 2006-11-29
10
550 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
  • 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
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 

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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
CDO.Message not able to send attachement 5 32
Downside of adding characters set in ASP pages 6 29
Html Table Looping (part 2) 5 27
Adjust an existing ASP Query 45 17
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 information …
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

860 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