View Full Version : use current windows user account to link to specific page

02-10-2005, 09:32 PM
Hello all,
I would like to know if there is anyway to find out what a user's windows user account is, and based on that, direct them to a specific page? Here's a breakdown of the scenerio: I'm building a website that will be used on our company's intranet. We will have a home page that will contain a link labeled: My Reports. We will have customized pages created for each business owner. When they click on the link, I would like for it to direct them to their personalized page based on what their windows user id is. Is there a way to do this? Javascript? ASP? HTML code to search the registry? ... All client machines will be Windows XP SP2 with IE 6 SP2. Thanks a bunch,


02-12-2005, 09:43 AM
Something involving ADSI, perhaps WSH, maybe clientInformation, possibly a userData store... definately MSDN. :eek:

02-23-2005, 04:09 PM
Thanks for the reply, codegoboom. My programmer bud here at work was able to acheive what we wanted with VBScript. Here's the code and note that in the link: userid = "http://home/id_" & objNet.UserName & ".htm"
the id_" is just the prefix to the name of the pages in which the user id was concatenated, so an example of a page name would be: http://home/id_jsmith.
you don't have to have the use that "id_" prefix to name your pages at all. it's just the scheme that we used.

<SCRIPT language="VBScript">
sub myreports_onclick
Dim objNet
dim userid
On Error Resume Next
Set objNet = CreateObject("WScript.NetWork")

userid = "http://home/id_" & objNet.UserName & ".htm"
Document.Location = userid

Set objNet = Nothing 'Destroy the Object
end sub

hope this helps anyone who may have the same need.

03-17-2005, 09:49 PM
I was able to successfully retrieve the user name of users on my intranet by using "User.Identity.Name". In other words strUserName = User.Identity.Name. I found a few other ways to capture the logon also, including the method you previously described.

On to a closely-related subject, in addition to capturing the user name, I need to capture the client MACHINE NAME. I have searched and searched and I can only find how to retrieve the machine name of the server. Does anyone have an idea of how to do this? Very much appreciated!

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum