Link to home
Start Free TrialLog in
Avatar of Morrow1
Morrow1

asked on

NT-LOGON with ASP

I am working on an INTRANET site.

The Environment we have is:
NT 4.0
IIS 5.0
SQL 7.0

I have a table "USERS" in the database with field "LoginName" which is same as the User-Logins on the Network.

I want to capture the User-Logon of the User that he is provided on the Network, when he visits this INTRANET site. BECASUE then i will compare that to the field in the table I have "USERS". And based upon -

*If his LOGON matches the "LoginName" in the table, he will get to see different content based upon the rules.


HOW WOULD I DO THAT ?

IN other words when I log on my network my Username is "WEBUSER". I have this record in the database for this INTRANET Site. Once I am authenticated thru NT on my machine I can log on to this site. I need a script /way/method to capture this "WEBUSER" Logon-Name in my ASP page to program further.

Please Help
Avatar of prokni
prokni

login_name= Request.ServerVariables("LOGON_USER")
I Also have the same problem but i have seen it ork on snitz forum
source code of which is available at snitz.com
but i didnt have luck in finding that code.
Avatar of Morrow1

ASKER

prokni...

i tried this, it doesnt work at all..

Tell me something if u have used it urself .... cuz then I can begin to look into it
I used this one by myself,
Do you let them to connect as anonymous?
ASKER CERTIFIED SOLUTION
Avatar of prokni
prokni

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hi prokni
how can i find the nt loginname description
I am not sure,
But I think it is better to go with ADSI for that.
Set myObj = GetObject("WinNT://" & Domain)
myobj.Filter = Array("user")
For Each user In myobj
    response.write "<br><b>User</b>:" & user.Name
    response.write ", <b>Parent is</b> : " & user.Parent
      response.write ", <b>AccountDisabled is</b> : " & user.AccountDisabled
Next

I am not sure if you can get user description with WinNT provider, you definitly can do it with LDAP provider on active directory.
Avatar of Morrow1

ASKER

BINGO prokni... Its working !!

I was unaware of the fact that I had the AnonymousLogin Enabled along with NT enable on my machine. I set the Anonymous to false and now I am able to trap the login name.

I guess thats a good sign.
One more question if you want to answer.

How long do you think the User will be recognized by the IIS thru this NT Authentication as i am Supposed to TURN OFF the Session too. Or does it stay untill the Browser is open.

I am going to accept ur answer anyways
Avatar of Morrow1

ASKER

Thanks for the Answer with description of the Security settings. It works and now I am able to trap the user login and play with it...
Avatar of Morrow1

ASKER

BINGO prokni... Its working !!

I was unaware of the fact that I had the AnonymousLogin Enabled along with NT enable on my machine. I set the Anonymous to false and now I am able to trap the login name.

I guess thats a good sign.
One more question if you want to answer.

How long do you think the User will be recognized by the IIS thru this NT Authentication as i am Supposed to TURN OFF the Session too. Or does it stay untill the Browser is open.

I am going to accept ur answer anyways
Actually I would keep the session timeout the same, What i am doing in my case, I check the session in the beginning of each page and if my session is empty then I forward them to the same page that they loged in, still it gets the Request.ServerVariables("LOGON_USER")).
    This one has nothing to do with session time out and still it gets the same login name information and starts all over again but it depends totally to your situation.

good luck
Avatar of Morrow1

ASKER

Thanks. It all works well........