473,395 Members | 2,192 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Reference a VBScript Variable in ASP

This is my VBScript function:

<script language="JavaScript" type="text/JavaScript">
Dim UN
Set objNet = CreateObject("WScript.NetWork")
Set objUser = GetObject("WinNT://my domain/" & objNet.UserName )
UN = objNet.UserName & " (" & objUser.FullName & ")"
</script>

How can I reference the VBScript Variable UN in my ASP code?
<%=UN%> won't work because VBScript is on the client side and ASP is on the
server side

If I have to post it on one page and read it on another, how do I do that?
I'm somewhat new to ASP...

Thanks!
Jul 19 '05 #1
6 13791
BP Prgm wrote:
This is my VBScript function:

<script language="JavaScript" type="text/JavaScript">
Dim UN
Set objNet = CreateObject("WScript.NetWork")
Set objUser = GetObject("WinNT://my domain/" & objNet.UserName )
UN = objNet.UserName & " (" & objUser.FullName & ")"
</script>

How can I reference the VBScript Variable UN in my ASP code?
<%=UN%> won't work because VBScript is on the client side and ASP is
on the server side

If I have to post it on one page and read it on another, how do I do
that? I'm somewhat new to ASP...


Well, you could do this:

<form id = frmLogin action="somepage.asp" method="post>
<input type=text style="visibility:hidden" id=txtLogin>
</form>
<script language="JavaScript" type="text/JavaScript">
Dim UN
Set objNet = CreateObject("WScript.NetWork")
Set objUser = GetObject("WinNT://my domain/" & objNet.UserName )
UN = objNet.UserName & " (" & objUser.FullName & ")"
frmLogin.txtLogin.value = UN
frmLogin.submit
</script>

And in somepage.asp:

<%
user = Request.Form("txtLogin")
%>

But, why bother? Use IIS Manager to configure your site to use Windows
Authentication and turn off Anonymous access. Then in ASP, use

user=Request.servervariables("LOGIN_USER")

to get the fully qualified login name of the user.

HTH,
Bob Barrows
Jul 19 '05 #2
I have used that, but I want to get some other items like the user's full
name and computer name. Is there a way I can conversely use ASP variables in
VBScript? That way I can put everything on one page and just use the
user=Request.servervariables("LOGIN_USER") to get the other info with
VBScript.
"Bob Barrows" <re*******@yahoo.com> wrote in message
news:Oh**************@TK2MSFTNGP10.phx.gbl...
BP Prgm wrote:
This is my VBScript function:

<script language="JavaScript" type="text/JavaScript">
Dim UN
Set objNet = CreateObject("WScript.NetWork")
Set objUser = GetObject("WinNT://my domain/" & objNet.UserName )
UN = objNet.UserName & " (" & objUser.FullName & ")"
</script>

How can I reference the VBScript Variable UN in my ASP code?
<%=UN%> won't work because VBScript is on the client side and ASP is
on the server side

If I have to post it on one page and read it on another, how do I do
that? I'm somewhat new to ASP...


Well, you could do this:

<form id = frmLogin action="somepage.asp" method="post>
<input type=text style="visibility:hidden" id=txtLogin>
</form>
<script language="JavaScript" type="text/JavaScript">
Dim UN
Set objNet = CreateObject("WScript.NetWork")
Set objUser = GetObject("WinNT://my domain/" & objNet.UserName )
UN = objNet.UserName & " (" & objUser.FullName & ")"
frmLogin.txtLogin.value = UN
frmLogin.submit
</script>

And in somepage.asp:

<%
user = Request.Form("txtLogin")
%>

But, why bother? Use IIS Manager to configure your site to use Windows
Authentication and turn off Anonymous access. Then in ASP, use

user=Request.servervariables("LOGIN_USER")

to get the fully qualified login name of the user.

HTH,
Bob Barrows

Jul 19 '05 #3
can't get computer name....sorry...
You MAY be able to get the full name if you have access to the AD info with
ADSI
--
----------------------------------------------------------
Curt Christianson (Software_AT_Darkfalz.Com)
Owner/Lead Designer, DF-Software
http://www.Darkfalz.com
---------------------------------------------------------
...Offering free scripts & code snippits for everyone...
---------------------------------------------------------

"BP Prgm" <no****@please.com> wrote in message
news:ej*************@TK2MSFTNGP11.phx.gbl...
I have used that, but I want to get some other items like the user's full
name and computer name. Is there a way I can conversely use ASP variables in VBScript? That way I can put everything on one page and just use the
user=Request.servervariables("LOGIN_USER") to get the other info with
VBScript.
"Bob Barrows" <re*******@yahoo.com> wrote in message
news:Oh**************@TK2MSFTNGP10.phx.gbl...
BP Prgm wrote:
This is my VBScript function:

<script language="JavaScript" type="text/JavaScript">
Dim UN
Set objNet = CreateObject("WScript.NetWork")
Set objUser = GetObject("WinNT://my domain/" & objNet.UserName )
UN = objNet.UserName & " (" & objUser.FullName & ")"
</script>

How can I reference the VBScript Variable UN in my ASP code?
<%=UN%> won't work because VBScript is on the client side and ASP is
on the server side

If I have to post it on one page and read it on another, how do I do
that? I'm somewhat new to ASP...


Well, you could do this:

<form id = frmLogin action="somepage.asp" method="post>
<input type=text style="visibility:hidden" id=txtLogin>
</form>
<script language="JavaScript" type="text/JavaScript">
Dim UN
Set objNet = CreateObject("WScript.NetWork")
Set objUser = GetObject("WinNT://my domain/" & objNet.UserName )
UN = objNet.UserName & " (" & objUser.FullName & ")"
frmLogin.txtLogin.value = UN
frmLogin.submit
</script>

And in somepage.asp:

<%
user = Request.Form("txtLogin")
%>

But, why bother? Use IIS Manager to configure your site to use Windows
Authentication and turn off Anonymous access. Then in ASP, use

user=Request.servervariables("LOGIN_USER")

to get the fully qualified login name of the user.

HTH,
Bob Barrows


Jul 19 '05 #4
In our Intranet, I have found that I am SOMETIMES able to get the computer
name via "REMOTE_NAME". Sometimes this servervariable only contains the ip
address of the machine - no idea why.

Bob

Curt_C [MVP] wrote:
can't get computer name....sorry...
You MAY be able to get the full name if you have access to the AD
info with ADSI

"BP Prgm" <no****@please.com> wrote in message
news:ej*************@TK2MSFTNGP11.phx.gbl...
I have used that, but I want to get some other items like the user's
full name and computer name. Is there a way I can conversely use ASP
variables in VBScript? That way I can put everything on one page and
just use the user=Request.servervariables("LOGIN_USER") to get the
other info with VBScript.
"Bob Barrows" <re*******@yahoo.com> wrote in message
news:Oh**************@TK2MSFTNGP10.phx.gbl...
BP Prgm wrote:
This is my VBScript function:

<script language="JavaScript" type="text/JavaScript">
Dim UN
Set objNet = CreateObject("WScript.NetWork")
Set objUser = GetObject("WinNT://my domain/" & objNet.UserName )
UN = objNet.UserName & " (" & objUser.FullName & ")"
</script>

How can I reference the VBScript Variable UN in my ASP code?
<%=UN%> won't work because VBScript is on the client side and ASP
is on the server side

If I have to post it on one page and read it on another, how do I
do that? I'm somewhat new to ASP...
Well, you could do this:

<form id = frmLogin action="somepage.asp" method="post>
<input type=text style="visibility:hidden" id=txtLogin>
</form>
<script language="JavaScript" type="text/JavaScript">
Dim UN
Set objNet = CreateObject("WScript.NetWork")
Set objUser = GetObject("WinNT://my domain/" & objNet.UserName )
UN = objNet.UserName & " (" & objUser.FullName & ")"
frmLogin.txtLogin.value = UN
frmLogin.submit
</script>

And in somepage.asp:

<%
user = Request.Form("txtLogin")
%>

But, why bother? Use IIS Manager to configure your site to use
Windows Authentication and turn off Anonymous access. Then in ASP,
use

user=Request.servervariables("LOGIN_USER")

to get the fully qualified login name of the user.

HTH,
Bob Barrows


Jul 19 '05 #5
This is my VBScript function:

<script language="JavaScript" type="text/JavaScript">
Dim UN
Set objNet = CreateObject("WScript.NetWork")
Set objUser = GetObject("WinNT://my domain/" & objNet.UserName )
UN = objNet.UserName & " (" & objUser.FullName & ")"
</script>

This would never run do to the language="JavaScript" with
VBScript Syntax embedded.
--
-------------------------------------------------
d l b j r

Unambit from meager knowledge of inane others,
engender uncharted sagacity.
-------------------------------------------------
Jul 19 '05 #6
dlbjr wrote:
This is my VBScript function:

<script language="JavaScript" type="text/JavaScript">
Dim UN
Set objNet = CreateObject("WScript.NetWork")
Set objUser = GetObject("WinNT://my domain/" & objNet.UserName )
UN = objNet.UserName & " (" & objUser.FullName & ")"
</script>

This would never run do to the language="JavaScript" with
VBScript Syntax embedded.


?
What does that have to do with my post? You DID reply to me.
Bob Barrows
Jul 19 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Jonas Daunoravicius | last post by:
The subject pretty much sums up what I need to do. Here is what I have so far, but still can't figure out how to get it working: <script language="javascript" type="text/javascript"> function...
3
by: Matt | last post by:
<% hour = Request("controlname") %> will yield the following error: Microsoft VBScript runtime (0x800A01F5) Illegal assignment: 'hour' However, if I declare hour, then it is fine. <% Dim...
3
by: Joe Caverly | last post by:
Hi, I'm using Visual C++ 32-bit Professional Edition 5.0 Using Microsoft Knowledge Base Article 181473 as a basis, I'm trying to transform this VB Code; Dim sc As Object Dim code As String...
2
by: ChucRock | last post by:
Hi, I have the following code where there is some client side VBScript that does something and needs to pass a variable back to the ASP.NET page. When the page is updated through a postback, the...
2
by: alan | last post by:
Hi all, I need to pass a variable to the client-side vbscript and when the button is pressed invoke the script (SomeSub()). The problem is, that the "blablabla" appears only after second...
7
by: Marja Ribbers-de Vroed | last post by:
I need to change a C++ COM Object so that it will correctly accept parameters by reference from a classic ASP/VBscript webapplication. I'm working from the article found here:...
3
by: Michael | last post by:
Hi. I have COM+ component installed on my XP. I have problem to create instance of it inside vbscript. How can I do it? The error I get is : ActiveX component can't create object. Thanks
2
by: moodyman13 | last post by:
Hi All, I’m in a bit of pickle with ASP and VBscript variable and hope someone could get me some advice. There’s a FORM’ I’ve created in ASP and its purpose is to capture the name(s) of users....
1
by: Igor Ladnik | last post by:
We are dealing with .NET server component and COM clients written with VB6 and VBScript. And there are some problems we faced (please see code below). 1. Managed type System Drawing.Color is...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.