|
-
Jan 16th, 2007, 10:35 AM
#1
Thread Starter
Addicted Member
[VB2005] Getting Windows account name using Windows Authentication
Anyone know how to get the name on the windows account using windows auth such as "Joe Smith"?
-
Jan 16th, 2007, 10:55 AM
#2
Fanatic Member
Re: [VB2005] Getting Windows account name using Windows Authentication
Try Request.LogonUserIdentity.Name
Using VB6 or VB.net 2008 with .net 3.5
"Life... death... either way I'll be confined to a small cubicle!" - Hermes Conrad
-
Jan 16th, 2007, 11:22 AM
#3
Thread Starter
Addicted Member
Re: [VB2005] Getting Windows account name using Windows Authentication
Thank you but no luck. It gives me "DOMAIN\username".
I would imagine if Windows can authenticate you then you should be able to obtain other account attributes.
Anyone have any suggestions?
-
Jan 16th, 2007, 12:06 PM
#4
Re: [VB2005] Getting Windows account name using Windows Authentication
-
Jan 16th, 2007, 12:15 PM
#5
Thread Starter
Addicted Member
Re: [VB2005] Getting Windows account name using Windows Authentication
How can I query the active directory without specifing a password? I am using Windows Authentication therefore the user is not typing in their logon info.
-
Jan 16th, 2007, 12:26 PM
#6
Re: [VB2005] Getting Windows account name using Windows Authentication
Change the query to search for the authenticated user, e.g. "(&(objecttype=person)(sAMAccountName=foo)", then use a "system" account to execute the query.
-
Jan 16th, 2007, 12:59 PM
#7
Thread Starter
Addicted Member
Re: [VB2005] Getting Windows account name using Windows Authentication
Can you provide a more detailed example? I am not following. Thanks.
-
Jan 16th, 2007, 07:50 PM
#8
Thread Starter
Addicted Member
Re: [VB2005] Getting Windows account name using Windows Authentication
I understand the search query, but what do you mean by a "system account to execute"?
Can you provide an example?
-
Jan 17th, 2007, 04:03 AM
#9
Re: [VB2005] Getting Windows account name using Windows Authentication
Make sure that Anonymous User are not allowed. In the Web Config, set
VB Code:
<authorization>
<deny users="?"/> ' "?" means anonymous user
</authorization>
Also check in IIS that Integrated Windows Authentication box is checked.
and in your code behind:
VB Code:
System.Security.Principal.IPrincipal user;
user = System.Web.HttpContext.Current.User;
string name = user.Identity.Name;
'Display name
-
Jan 17th, 2007, 07:34 AM
#10
Thread Starter
Addicted Member
Re: [VB2005] Getting Windows account name using Windows Authentication
Thanks but it gives me the 'username'. I need the account name or common name such as 'John Doe'.
Does anyone know how to obtain this without using LDAP?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|