Reference a VBScript Variable in ASP

Ask a Question related to ASP, Design and Development.

  1. #1

    Default 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!


    BP Prgm Guest

  2. Similar Questions and Discussions

    1. Reference a variable in a repeater
      I have some code that worked fine until a created a repeater. I get an error (BC30451) that I've researched on Google groups, etc., to no avail. ...
    2. Help with variable reference in perl OOD
      I need to be able to set a variable equal to the value of an OOD reference such that when the reference changes, the the variable changes as well...
    3. Returning a reference to a class variable
      I have a class which contains (1) a class variable and (2) a method (e.g., methodA) which returns a reference to the class variable. If the...
    4. Variable reference
      Par <paer_nystroem@hotmail.com> wrote: $var{ $part1 . $part2 } or $var{ "$part1$part2" } --
    5. passing javascript variable into asp variable using vbscript
      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...
  3. #2

    Default Re: Reference a VBScript Variable in ASP

    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


    Bob Barrows Guest

  4. #3

    Default Re: Reference a VBScript Variable in ASP

    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" <reb_01501@yahoo.com> wrote in message
    news:Ohu3kqwVDHA.2192@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
    >
    >

    BP Prgm Guest

  5. #4

    Default Re: Reference a VBScript Variable in ASP

    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
    [url]http://www.Darkfalz.com[/url]
    ---------------------------------------------------------
    ...Offering free scripts & code snippits for everyone...
    ---------------------------------------------------------

    "BP Prgm" <nospam@please.com> wrote in message
    news:ejqeqJxVDHA.424@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" <reb_01501@yahoo.com> wrote in message
    > news:Ohu3kqwVDHA.2192@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
    > >
    > >
    >
    >

    Curt_C [MVP] Guest

  6. #5

    Default Re: Reference a VBScript Variable in ASP

    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" <nospam@please.com> wrote in message
    > news:ejqeqJxVDHA.424@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" <reb_01501@yahoo.com> wrote in message
    >> news:Ohu3kqwVDHA.2192@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


    Bob Barrows Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139