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