473,594 Members | 2,658 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Reference a VBScript Variable in ASP

This is my VBScript function:

<script language="JavaS cript" type="text/JavaScript">
Dim UN
Set objNet = CreateObject("W Script.NetWork" )
Set objUser = GetObject("WinN T://my domain/" & objNet.UserName )
UN = objNet.UserName & " (" & objUser.FullNam e & ")"
</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 13813
BP Prgm wrote:
This is my VBScript function:

<script language="JavaS cript" type="text/JavaScript">
Dim UN
Set objNet = CreateObject("W Script.NetWork" )
Set objUser = GetObject("WinN T://my domain/" & objNet.UserName )
UN = objNet.UserName & " (" & objUser.FullNam e & ")"
</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="somepag e.asp" method="post>
<input type=text style="visibili ty:hidden" id=txtLogin>
</form>
<script language="JavaS cript" type="text/JavaScript">
Dim UN
Set objNet = CreateObject("W Script.NetWork" )
Set objUser = GetObject("WinN T://my domain/" & objNet.UserName )
UN = objNet.UserName & " (" & objUser.FullNam e & ")"
frmLogin.txtLog in.value = UN
frmLogin.submit
</script>

And in somepage.asp:

<%
user = Request.Form("t xtLogin")
%>

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.se rvervariables(" 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.se rvervariables(" LOGIN_USER") to get the other info with
VBScript.
"Bob Barrows" <re*******@yaho o.com> wrote in message
news:Oh******** ******@TK2MSFTN GP10.phx.gbl...
BP Prgm wrote:
This is my VBScript function:

<script language="JavaS cript" type="text/JavaScript">
Dim UN
Set objNet = CreateObject("W Script.NetWork" )
Set objUser = GetObject("WinN T://my domain/" & objNet.UserName )
UN = objNet.UserName & " (" & objUser.FullNam e & ")"
</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="somepag e.asp" method="post>
<input type=text style="visibili ty:hidden" id=txtLogin>
</form>
<script language="JavaS cript" type="text/JavaScript">
Dim UN
Set objNet = CreateObject("W Script.NetWork" )
Set objUser = GetObject("WinN T://my domain/" & objNet.UserName )
UN = objNet.UserName & " (" & objUser.FullNam e & ")"
frmLogin.txtLog in.value = UN
frmLogin.submit
</script>

And in somepage.asp:

<%
user = Request.Form("t xtLogin")
%>

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.se rvervariables(" 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_Da rkfalz.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******** *****@TK2MSFTNG P11.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.se rvervariables(" LOGIN_USER") to get the other info with
VBScript.
"Bob Barrows" <re*******@yaho o.com> wrote in message
news:Oh******** ******@TK2MSFTN GP10.phx.gbl...
BP Prgm wrote:
This is my VBScript function:

<script language="JavaS cript" type="text/JavaScript">
Dim UN
Set objNet = CreateObject("W Script.NetWork" )
Set objUser = GetObject("WinN T://my domain/" & objNet.UserName )
UN = objNet.UserName & " (" & objUser.FullNam e & ")"
</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="somepag e.asp" method="post>
<input type=text style="visibili ty:hidden" id=txtLogin>
</form>
<script language="JavaS cript" type="text/JavaScript">
Dim UN
Set objNet = CreateObject("W Script.NetWork" )
Set objUser = GetObject("WinN T://my domain/" & objNet.UserName )
UN = objNet.UserName & " (" & objUser.FullNam e & ")"
frmLogin.txtLog in.value = UN
frmLogin.submit
</script>

And in somepage.asp:

<%
user = Request.Form("t xtLogin")
%>

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.se rvervariables(" 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_NAM E". 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******** *****@TK2MSFTNG P11.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.se rvervariables(" LOGIN_USER") to get the
other info with VBScript.
"Bob Barrows" <re*******@yaho o.com> wrote in message
news:Oh******** ******@TK2MSFTN GP10.phx.gbl...
BP Prgm wrote:
This is my VBScript function:

<script language="JavaS cript" type="text/JavaScript">
Dim UN
Set objNet = CreateObject("W Script.NetWork" )
Set objUser = GetObject("WinN T://my domain/" & objNet.UserName )
UN = objNet.UserName & " (" & objUser.FullNam e & ")"
</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="somepag e.asp" method="post>
<input type=text style="visibili ty:hidden" id=txtLogin>
</form>
<script language="JavaS cript" type="text/JavaScript">
Dim UN
Set objNet = CreateObject("W Script.NetWork" )
Set objUser = GetObject("WinN T://my domain/" & objNet.UserName )
UN = objNet.UserName & " (" & objUser.FullNam e & ")"
frmLogin.txtLog in.value = UN
frmLogin.submit
</script>

And in somepage.asp:

<%
user = Request.Form("t xtLogin")
%>

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.se rvervariables(" 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="JavaS cript" type="text/JavaScript">
Dim UN
Set objNet = CreateObject("W Script.NetWork" )
Set objUser = GetObject("WinN T://my domain/" & objNet.UserName )
UN = objNet.UserName & " (" & objUser.FullNam e & ")"
</script>

This would never run do to the language="JavaS cript" 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="JavaS cript" type="text/JavaScript">
Dim UN
Set objNet = CreateObject("W Script.NetWork" )
Set objUser = GetObject("WinN T://my domain/" & objNet.UserName )
UN = objNet.UserName & " (" & objUser.FullNam e & ")"
</script>

This would never run do to the language="JavaS cript" 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
72134
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 fillForm() { // split the query string into pieces var qs = location.search.substr(location.search.indexOf("?")+1); qs = qs.split("&"); alert(qs); // qs is the variable that I need to pass into a
3
15172
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 hour hour = Request("controlname") %>
3
7021
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 Set sc = CreateObject("ScriptControl") sc.Language = "VBScript"
2
2586
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 information is lost. What am I doing wrong? After obtaining the variable, I assign it back to a Label text field on the form, it shows up on the web page no problem.
2
1917
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 pressing of the button. Probably there is something with the postback, but I cannot figure it out. My .aspx :
7
1262
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: http://support.microsoft.com/kb/197957/EN-US/, as this article descibes my problem with the COM Object exactly. The article gives the following original example method: STDMETHODIMP CByRefObj::ByRefMethod( BSTR* bstrVal ) { CComBSTR bstrRtnVal = L"This variable...
3
8537
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
8509
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. The plan is then to pass the information from ASP to VBScript. My dilemma is how to extract the information in ASP and use it in VBScript. (Please see code below) Iíve read in some forums that is simply canít be done. Unfortunately, I canít run...
1
1763
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 automatically marshaled to VB type OLE_COLOR only in case of early binding. (see DealWithColor() method). 2. For class Component public variable DateTime dt can be used in both early and late binding cases, whereas public variable Color clr causes...
0
7882
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8259
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8016
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8244
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
5836
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Duprť who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5415
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
3905
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1487
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1218
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.