# NT login



## denesh (Jul 5, 2005)

Hello. What I am tring to do is that when a user logs onto the network I went the name of that person to be displayed on the intranet when they access the intranet. Is there anyway that this can be done and how


----------



## Rockn (Jul 29, 2001)

Seen where on the intranet? Intranets are usually web based applications, this would be a function of that application not the NT login.


----------



## denesh (Jul 5, 2005)

what me want to do is to display the users name on the intranet by using the NT login so that when they are logged onto the Network and they view the intranet its got their name displayed.


----------



## Squashman (Apr 4, 2003)

The only thing I think you could do is run a script at login that updates some type of database which publishes to a webpage. Never done it but I am sure it is possible.

Or you could do this:
Schedule a Program like NBTscan to run on your network every minute or so. Have the output of that published to a webpage or a share on the network where users can view the file.


----------



## Rockn (Jul 29, 2001)

Don't they have to log onto the intranet? Use the intranet login to track their sessions on the application.


----------



## DoubleHelix (Dec 10, 2004)

The ID they use to log in is stored in the registry. Can you pull that and get the person's name from Active Directory (or something like that).

Web Dev isn't my forte, but I'm tryin' here.


----------



## denesh (Jul 5, 2005)

Ok the plan is that I am creating a Intranet. I am not using a database. What I would like to do is to get the name of the person logged onto the network and publish that name on the Intranet. Does anyone have any ideas in how to do this


----------



## DoubleHelix (Dec 10, 2004)

Unless people log in with their actual name, you'll have to do some sort of referencing between the login info used on the local computer and another system that translates that to a name.


----------



## Rockn (Jul 29, 2001)

What are you writing your intranet application in? I believe .Net can access anything in Active directory as mentioned earlier.


----------



## denesh (Jul 5, 2005)

I am using Dreamweaver to create the Intranet. Do u know how to do this because I dont have a clue and dont know where to start


----------



## Rockn (Jul 29, 2001)

Your web server has to run .net forst off and be able to access AD. I would look for .net tutorials and put Active Directory into the search parameters as well.


----------



## drdrew1469 (Nov 30, 2000)

Simply put, for your intranet you will need to have "Integrated Windows Authentication" selected only on the "Directory Security" tab. Your users will login to the network and be authenticated for Intranet access (those without authenticating will have a popup box for credentials on their first visit to the Intranet). Next put this in you code where you want it.

Welcome, <%Response.Write (Request.ServerVariables("auth_user"))%>

That's it. Now if you want to get more technical with it you can add other fields to manipulate it.

You can make it bold:

Welcome, *<%Response.Write (Request.ServerVariables("auth_user"))%>*

Strip out the domain name if applicable (DOMAIN\username). The "8" below would be counted from the left to remove 7 letters of the domain name plus 1 for the \

Welcome, *<%Response.Write Mid(Request.ServerVariables("auth_user"),8))%>*

Convert the case

Welcome, *<%Response.Write ucase(Mid(Request.ServerVariables("auth_user"),8))%>*

Whatever you want, just mod it to your liking. You asked for "can and how". How about "yes and like this". I hope this helps. 

drew


----------



## denesh (Jul 5, 2005)

hey drdrew1469 me tried the code you gave it it doesnt work. Me created a test page

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">

Untitled Document

Welcome, <%Response.Write (Request.ServerVariables("auth_user"))%>

and uploaded it but it didnt work. The Integrated Windows Authentication is already set up in the school. Any ideas


----------



## drdrew1469 (Nov 30, 2000)

First, save this as an asp file (not mandatory, but mine is, I think html should work also if everything else is configured properly). Second, make sure you are testing it from an iis server. Third an most important, make sure that iis is configured properly or it won't work at all! (see above).

I set this up on my intranet here at work a while ago and it's run beautifully ever since. You are missing something along the way, let me know how you make out.

hth,

drew


----------



## denesh (Jul 5, 2005)

the server @ school which stores the intranet is managed by a third party company so what I will do is to see if iis is installed. The code above which i have created to test sample on does it look ok to u


----------



## drdrew1469 (Nov 30, 2000)

yes, when placed on my server it shows: "Welcome, drdrew1469" (without quotes), so the code is working. I checked this with an .html extension and an .asp extension, both work fine.

drew


----------



## Rockn (Jul 29, 2001)

Yea, the AUTH_USER works on my end as well. Perhaps the host does not allow server variables to be shown for hosted sites for security reasons.


----------



## drdrew1469 (Nov 30, 2000)

Rockn said:


> Yea, the AUTH_USER works on my end as well. Perhaps the host does not allow server variables to be shown for hosted sites for security reasons.


Quick and easy...just like me!  It's amazing, I will spend twice as long on something just to figure out the simplest, easiest, least coding way to do something, especially if the "accepted methods" are overdone (heavily coded to look complicated) or need three days of involvement to implement.

*denesh,*
It should be the school's call to implement this if it's their server, they just have someone else running it, which brings me to my next question...why is someone else running the server if you are coding pages for it? just curious.

drew


----------



## denesh (Jul 5, 2005)

sorry missunderstanding it is their own server. Drew another question when a user logs on like for example my logon is dha is that the name that will show up or will it bring up my full name if not how can this be done


----------



## drdrew1469 (Nov 30, 2000)

you will see whatever the user logs in as. if i login as drdrew, then that's what i'll see. my users login with abc_username, so that's what i saw, until i applied MID and position number in the above examples.

for "full name", i'm thinking an association. making the page query the auth_user and actually return another value from a db associated with that auth_user login name. it wouldn't be that hard to do...(i've already done that too) 

1. make a file as shown below and save it as username.csv

auth,name
loginname,Actual Name

2. paste this code.

#data

[TR]
[TD]Welcome, [/TD]
[TD]
[/TD]
[/TR]

[/TABLE]

3. enjoy. this will return the 'name' field from the username.csv file after the request for the auth-user is made and then matched to the db 'auth' field. they have to be in the same directory in this example.

damn, i'm good 

drew


----------



## denesh (Jul 5, 2005)

sorry its abit hard 2 undestand. So say i wanted to do this what would I have 2 do from the start. What db are u using. Are you using the NT database or did u create one. Im not a good programmer but it makes a little sence.

U r good


----------



## drdrew1469 (Nov 30, 2000)

the steps i listed are the entire process. i created the db, but you could use an existing db, just make sure the headings match 'auth' and 'name' for the code i provided. as far as an NT db, i'm not sure what you mean, if your talking about exporting the Active Directory users list, that won't give you what you need, so creating one with just 'auth' and 'name' is the easiest thing to do.

username.csv should look like

auth,name
L123,Larry
M456,Moe
C789,Curly

that's it.

now, wherever you want 'Welcome, Larry' to show up (in your home page, or at the top of each page, wherever you want it) paste in the code from step 2 above. make sure the 'coded page(s)' and 'username.csv' are in the same directory and you're all set.

hth,

drew


----------

