Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Capturing Logged In User

Status
Not open for further replies.

richrich05

Programmer
Aug 15, 2005
24
US
Does anyone know away i can pull the logged in username from a computer for a webform?


this is what i did to pull from the cookie
~ <input type="text" name="EmailID" maxlength="10" size="10" Value="<%=Request.Cookies("NPSC")("UserName")%>"
~
 
Take a look at the LOGON_USER item in the Request.ServerVariables collection.
 
I wrote <%Response.Write(Request.ServerVariables("LOGON_USER"))%> and it returned a blank string my server allows for Anonymous Access to the sites on it.
 
ASP resides on the server, so you would have to do this on the client (javascript).

Code:
<script>
var wshshell=new ActiveXObject("wscript.shell");
var username=wshshell.ExpandEnvironmentStrings("%username%");
alert("You are logged in as '" + username + "'");
</script>


Olav Alexander Mjelde
Admin & Webmaster
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top