Reference a VBScript Variable in ASP

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • BP Prgm

    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!


  • Bob Barrows

    #2
    Re: Reference a VBScript Variable in ASP

    BP Prgm wrote:[color=blue]
    > 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...
    >[/color]

    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


    Comment

    • BP Prgm

      #3
      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.se rvervariables(" LOGIN_USER") to get the other info with
      VBScript.


      "Bob Barrows" <reb_01501@yaho o.com> wrote in message
      news:Ohu3kqwVDH A.2192@TK2MSFTN GP10.phx.gbl...[color=blue]
      > BP Prgm wrote:[color=green]
      > > 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...
      > >[/color]
      >
      > 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
      >
      >[/color]


      Comment

      • Curt_C [MVP]

        #4
        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_Da rkfalz.Com)
        Owner/Lead Designer, DF-Software

        ---------------------------------------------------------
        ...Offering free scripts & code snippits for everyone...
        ---------------------------------------------------------

        "BP Prgm" <nospam@please. com> wrote in message
        news:ejqeqJxVDH A.424@TK2MSFTNG P11.phx.gbl...[color=blue]
        > 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[/color]
        in[color=blue]
        > 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" <reb_01501@yaho o.com> wrote in message
        > news:Ohu3kqwVDH A.2192@TK2MSFTN GP10.phx.gbl...[color=green]
        > > BP Prgm wrote:[color=darkred]
        > > > 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...
        > > >[/color]
        > >
        > > 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
        > >
        > >[/color]
        >
        >[/color]


        Comment

        • Bob Barrows

          #5
          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_NAM E". Sometimes this servervariable only contains the ip
          address of the machine - no idea why.

          Bob

          Curt_C [MVP] wrote:[color=blue]
          > 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:ejqeqJxVDH A.424@TK2MSFTNG P11.phx.gbl...[color=green]
          >> 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" <reb_01501@yaho o.com> wrote in message
          >> news:Ohu3kqwVDH A.2192@TK2MSFTN GP10.phx.gbl...[color=darkred]
          >>> 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[/color][/color][/color]



          Comment

          • dlbjr

            #6
            Re: 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>

            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.
            -------------------------------------------------


            Comment

            • Bob Barrows

              #7
              Re: Reference a VBScript Variable in ASP

              dlbjr wrote:[color=blue]
              > 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.[/color]

              ?
              What does that have to do with my post? You DID reply to me.
              Bob Barrows


              Comment

              Working...