|
| |
|
|
BeTheBall
Posts: 6359 Joined: 6/21/2002 From: West Point Utah USA Status: offline
|
NT authentication - 3/10/2003 15:16:56
I have a db table that contains a list of all employees. I want to display certain field from that table on a webpage. If I add each employee' s NT Login to the DB, can I then format my page so that it will recognize the employee when he/she opens the page and display his/her data???
|
|
|
|
BeTheBall
Posts: 6359 Joined: 6/21/2002 From: West Point Utah USA Status: offline
|
RE: NT authentication - 3/11/2003 18:21:43
Thanks for the help Spooky. I think most of the things you suggest are already done. The web where I am going to use this is already a NT authenticated web with no anonymous access. Also, I believe our IT people have granted access to all domain users. Is there a small piece of code that I could paste on a page and then view in my browser to see if it returns my NT login info? This would let me know if I am ready to go.
_____________________________
Duane Some people are like Slinkies . . . Not really good for anything . . . . . But they still bring a smile to your face when you push them down a flight of stairs.
|
|
|
|
BeTheBall
Posts: 6359 Joined: 6/21/2002 From: West Point Utah USA Status: offline
|
RE: NT authentication - 3/12/2003 11:17:56
Hey, works great! It returns Domain\Username. Is there any way to parse out the domain\ out of the results? My database contains the username only and I really don' t want to append the domain\ to every record. Also, how would I write my SQL? Select * from table WHERE login = ?????
< Message edited by betheball -- 3/12/2003 11:27 AM >
|
|
|
|
BeTheBall
Posts: 6359 Joined: 6/21/2002 From: West Point Utah USA Status: offline
|
RE: NT authentication - 3/12/2003 13:52:54
Spooky, I am losing my mind. Before my last post I created a page called test.asp. In between the <body> tags I pasted: <%=request.servervariables(" LOGON_USER" )%> I then saved the page and viewed it in my brower. Sure enough, I see OSC\ddthom29, my domain\login ID. I then messed with a few things, went back to the page and it now won' t show anything. The page comes back blank. Any ideas what may have happened. I even tried creating a new page with only the above code in the body and nothing???
< Message edited by betheball -- 3/12/2003 1:54 PM >
|
|
|
|
BeTheBall
Posts: 6359 Joined: 6/21/2002 From: West Point Utah USA Status: offline
|
RE: NT authentication - 3/13/2003 8:34:40
Thanks again Spooky. We had deleted the anonymous user account from the list of authorized users, but I didn' t realize that the anonymous user was also part of the EVERYONE group. I do find it odd that the page worked momentarily because IT rarely messes with the server and they would have had to have done something minutes after I first tested the page because it worked, then 5 minutes later, it didn' t. Oh well, I found a NT group that all of my intended users belong to, so I added it and deleted the Everyone group from the list.
|
|
|
|
BeTheBall
Posts: 6359 Joined: 6/21/2002 From: West Point Utah USA Status: offline
|
RE: NT authentication - 3/13/2003 14:01:17
OK Spooky (or anyone else), one more question. If I wanted to simply display " Hello (Login)" , how would I do it. In other words, similar to what you showed me in the SQL, how would I parse out the domain\ to simply display the login name in the body of my page. I am sure it is becoming increasingly obvious how little I know about coding, but these questions help me learn.
|
|
|
|
Nathan Goulette
Posts: 274 Joined: 1/12/2003 From: Phoenix, AZ Status: offline
|
RE: NT authentication - 10/4/2004 19:43:35
I know that I can use <%=request.servervariables(" LOGON_USER" )%> to get the DOMAIN\USERNAME of the person logged on. I can also get this data into a FORM FIELD without issue. However, How would I strip DOMAIN\ from the result just leaving me with the USERNAME? Thanks. Nate
|
|
|
|
BeTheBall
Posts: 6359 Joined: 6/21/2002 From: West Point Utah USA Status: offline
|
RE: NT authentication - 10/4/2004 19:48:02
If you are like us, your usernames are a distinct length. Ours are 8 characters. So, I was able to simply use: Right(Request.Servervariables("Logon_User"),8)
_____________________________
Duane Some people are like Slinkies . . . Not really good for anything . . . . . But they still bring a smile to your face when you push them down a flight of stairs.
|
|
|
|
Nathan Goulette
Posts: 274 Joined: 1/12/2003 From: Phoenix, AZ Status: offline
|
RE: NT authentication - 10/4/2004 19:54:27
Well they are no longer than 8 characters but they are not all 8 characters. Mary Lee would only be 4 characters so unfirtunetally, I do not think that will work for this. Any other thoughts?
|
|
|
|
BeTheBall
Posts: 6359 Joined: 6/21/2002 From: West Point Utah USA Status: offline
|
RE: NT authentication - 10/4/2004 19:58:37
Use the Mid function. If your domain name is ABCD, then you use the following to get just the username: <%=Mid(Request.Servervariables("Logon_User"),6)%> The "6", tells the code to bring back all characters from the 6th position on, thus eliminating the ABCD and the "\".
_____________________________
Duane Some people are like Slinkies . . . Not really good for anything . . . . . But they still bring a smile to your face when you push them down a flight of stairs.
|
|
|
|
Nathan Goulette
Posts: 274 Joined: 1/12/2003 From: Phoenix, AZ Status: offline
|
RE: NT authentication - 10/4/2004 20:03:26
Sweet, worked like charm! Thanks BeTheBall!
|
|
|
|
rdouglass
Posts: 9224 From: Biddeford, ME USA Status: offline
|
RE: NT authentication - 10/6/2004 11:04:01
Just my $.02 - I use it dynamically like this: <% MyVar=request.servervariables("logon_user") MyVar=MyVar & "" MyPos = InstrRev(MyVar, "/", -1, 1) UserName=Mid(MyVar,MyPos+1,Len(MyVar)) %> That works with any domain at any length.
_____________________________
Don't take you're eye off your final destination. ASP Checkbox Function Tutorial.
|
|
|
|
BeTheBall
Posts: 6359 Joined: 6/21/2002 From: West Point Utah USA Status: offline
|
RE: NT authentication - 10/6/2004 11:21:33
He lives! Good to "see" you rdouglass. I will file that snippet away in my collection.
_____________________________
Duane Some people are like Slinkies . . . Not really good for anything . . . . . But they still bring a smile to your face when you push them down a flight of stairs.
|
|
|
|
Nathan Goulette
Posts: 274 Joined: 1/12/2003 From: Phoenix, AZ Status: offline
|
RE: NT authentication - 10/6/2004 11:37:52
Ok, I just tried this method and then in the form I put <%response.write UserName%> but it isn't showing anything. Should I not be using the response.write to output the info? Thanks Nate
|
|
|
|
rdouglass
Posts: 9224 From: Biddeford, ME USA Status: offline
|
RE: NT authentication - 10/6/2004 12:17:54
quote:
<% MyVar=request.servervariables("logon_user") MyVar=MyVar & "" MyPos = InstrRev(MyVar, "/", -1, 1) UserName=Mid(MyVar,MyPos+1,Len(MyVar)) %> Try DIM'ming it first: <% DIM UserName MyVar=request.servervariables("logon_user") MyVar=MyVar & "" MyPos = InstrRev(MyVar, "/", -1, 1) UserName=Mid(MyVar,MyPos+1,Len(MyVar)) %>
_____________________________
Don't take you're eye off your final destination. ASP Checkbox Function Tutorial.
|
|
|
|
Nathan Goulette
Posts: 274 Joined: 1/12/2003 From: Phoenix, AZ Status: offline
|
RE: NT authentication - 10/6/2004 12:24:47
That didn't go either... Any other thoughts?
|
|
|
|
Nathan Goulette
Posts: 274 Joined: 1/12/2003 From: Phoenix, AZ Status: offline
|
RE: NT authentication - 10/6/2004 12:26:10
Awe Crap.. Hang on, lemme try something. I forgot that the test web that I use, I changed the permissions to allow the anon user. Let me test it in a web with challenge response...
|
|
|
|
Nathan Goulette
Posts: 274 Joined: 1/12/2003 From: Phoenix, AZ Status: offline
|
RE: NT authentication - 10/6/2004 12:36:22
Ok, I am getting a response now but it is the username with the domain...
|
|
|
|
BeTheBall
Posts: 6359 Joined: 6/21/2002 From: West Point Utah USA Status: offline
|
RE: NT authentication - 10/6/2004 12:48:39
Your slash is going the wrong way down a one-way street. Try: MyPos = InstrRev(MyVar, "\", -1, 1)
_____________________________
Duane Some people are like Slinkies . . . Not really good for anything . . . . . But they still bring a smile to your face when you push them down a flight of stairs.
|
|
|
|
Nathan Goulette
Posts: 274 Joined: 1/12/2003 From: Phoenix, AZ Status: offline
|
RE: NT authentication - 10/6/2004 12:52:18
Bingo! That is better so that I can use the code and not have to worry about the length of the domain name. This works well since we have multiple domains that access the same site. Sweet! Thanks again guys. Nate
|
|
|
|
alexp
Posts: 3 Joined: 10/7/2004 Status: offline
|
RE: NT authentication - 10/7/2004 9:13:19
Hi All, Has anyone developed a web page(asp, aspx) that allows a field for user password domain once they submit these inputs, if they are successful, they go to the logged-in page. As the viewer goes from page to page, I will want to pass their userid and that they were authenticated. I don't need a fully written deal, I just can't seem to find the right code to get started. Thanks in advance. Alex
|
|
|
|
rdouglass
Posts: 9224 From: Biddeford, ME USA Status: offline
|
RE: NT authentication - 10/7/2004 9:21:41
Hi Alex and Welcome to Outfront. I never have to code for the username/password/domain prompt if (at the server) you turn on Integrated Windows Authentication and turn *off* anonymous access to whatever directory the page is stored in. If that's setup, when you browse to a page in that directory, the server will prompt for those credentials if you're not already logged into the domain. Then you can use the code above to do whatever you want, I tend to set a session variable and then use that on all pages I need it. For instance, the code above could be: <% DIM UserName MyVar=request.servervariables("logon_user") MyVar=MyVar & "" MyPos = InstrRev(MyVar, "\", -1, 1) UserName=Mid(MyVar,MyPos+1,Len(MyVar)) Session("myUserName")=UserName %> Then, as long as the session is valid, just use it on any asp page like this: <%=Session("myUserName")%> Does that help?
_____________________________
Don't take you're eye off your final destination. ASP Checkbox Function Tutorial.
|
|
|
|
alexp
Posts: 3 Joined: 10/7/2004 Status: offline
|
RE: NT authentication - 10/7/2004 9:45:53
Hi Douglass, Thanks for quick reply. (I like your code for stripping any domain name, I was using MID function myself, but that is not as slick as yours) My problem is for users who are accessing web site from the Internet (everything works ok from intranet site), some user cannot type their user name-password-domain info. Also in XP, IE now displays 2 text boxes, instead of 3, so you have to use DOMAIN\USERNAME or e-mail as user name and then password. Any way i just wanted to make it easier for users to login from outside. Sorry for the long explanation. Thank you, Alex
|
|
|
|
rdouglass
Posts: 9224 From: Biddeford, ME USA Status: offline
|
RE: NT authentication - 10/7/2004 10:00:29
If you put a default domain in the Directory Security:Edit section, the users will not have to put the domain in. Just UserName and Password will suffice (as long as they are users in the default domain of course). You said you're not getting the dialogue box for some users? Do you have Anonymous Access turned off for that directory?
_____________________________
Don't take you're eye off your final destination. ASP Checkbox Function Tutorial.
|
|
|
|
alexp
Posts: 3 Joined: 10/7/2004 Status: offline
|
RE: NT authentication - 10/7/2004 12:33:20
I am getting authentication box, I want to replace it with web (asp) form. Thank you. Alex
|
|
New Messages |
No New Messages |
Hot Topic w/ New Messages |
Hot Topic w/o New Messages |
Locked w/ New Messages |
Locked w/o New Messages |
|
Post New Thread
Reply to Message
Post New Poll
Submit Vote
Delete My Own Post
Delete My Own Thread
Rate Posts
|
|
|