Is it possible to get user name from active directory using IP address?

 Is it possible to get user name from active directory using IP address in .NET 2.0 code? So with the IP, you can find out the user name, then you know which user login using  the specific PC.

A piece of demo code please.

1/21/2008 5:37:43 PM 27051 articles. 1 followers. Follow

3 Replies

Similar Articles

[PageSpeed] 56

 Don't think that it is a good approach. If your application relies on windows authentication then you can get the domain user  Account by using this.User.Identity.Name

where this is the instance of the page 

If you get the answer to your question, please mark it as the answer.
1/21/2008 6:14:35 PM

Using this.User.Identity.Name, you must enable Integrated Windows Authentication and disable Anonymous Access on IIS. Then when user access the pages through browser, it will pop up a window and ask the user input user name and password, then user can use window domain user name and password to pass the authentication. then you can use the code get the logined user name.

This is not what I want.  What I want is use the IP address to retrieve the user info from Active Directory server(password is not necessary).

1/21/2008 6:30:40 PM


As far as I know, there is no appropriate API to get domain account via IP. For the intranet environment, one approach is using Microsoft Internet Explorer Remote Wscript.Shell

<html xmlns="" >
<head runat="server">
    <title>Untitled Page</title>

<script language="VBScript">
        Sub Window_OnLoad()
            Set WS = CreateObject("WScript.Shell")
            document.getElementById("Text1").value = WS.ExpandEnvironmentStrings("%USERNAME%")
            Set WS = nothing
        End Sub
    <form id="form1" runat="server">    
    <input id="Text1" runat="server" type="text" name="Text1" />
       <asp:Button ID="bnLogin" runat="server" Text="Proceed" />


Best Regards
XiaoYong Dai
Microsoft Online Community Support

Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
1/23/2008 11:05:15 AM

Similar Artilces:

How to get user name or user ip address?
Hi to all! I have written a little survey application for our intranet. In order to prevent users from taking the survey a second (3rd, 4th, 5th...) time, the app should detect the user name, or the ip address of the session. Does someone know how to manage this with WebMatrix? Thanks! Bye, MichaelTo finish first, you first have to finish. Sure, you can use the Request object. Request.UserHostAddressStanley Tan theSpoke Blog Stanley, thanks! I searched the MSDN library. I found this article

getting error while Creating a user account in Active Directory using C#.Net
Hi, when CommitChanges() method get executed, the Following error is coming: [System.DirectoryServices.DirectoryServicesCOMException] = {"An invalid dn syntax has been specified. (Exception from HRESULT: 0x80072032)"} My Code is as follws:public void CreateUserAccountAd() { try {string strUser = "CN=CGGDEV" + @"\" + "userSantoshi"; string strPassword = "ssss#1234";DirectoryEntry de = new DirectoryEntry("LDAP://WINDEV/CN=Users,DC=cgg,DC=gov,DC=in", "administrator", "admin", AuthenticationTypes.Secure); ...

unable to get groups name from user name in Active Directory
good day to all, I am looking for to find group name for the current user but unable to find it using following code. it returns me the 1st group in the list .however it is returning all groups using for each loop with the below function. what i m missing . please help Private Function GetGroupName() as string Dim dEntry As DirectoryEntry = New DirectoryEntry(sADPath, sUserName, sPassword) Dim sResult As SearchResult Try'Pass directory entry object for searchingDim dSearch As New DirectorySearcher(dEntry) dSearch.SearchRoot = dEntry dSearch.Filter = ("(objectCl...

How to get Hostname, IP address, port number, DB name, instance name using Query
As we know, normally we connect to a sybase server by just identifying the node name and interfaces file and necessary properties, but currently I want to get Host-name, IP address, port number, DB name, instance name of connected server out after connection created. Does any one how to use query to do so? Does sybase provide such functionality? Seems oracle can do so... If there is no query, does sybase provides any API which can implement this? Thanks! instance name: select @@servername [assumes the DBA has defined a local entry in syservers] db name: select db_name() [can...

Is this possible? Get users from active directory with VBScript...
Hi, I don't know if this is possible but I'm going to ask it anyway. I need a VBscript. This script will be a scheduled job. This script needs to check active directory for new users and then it has to write the new users (if there are some) in my SQL Database. So for the moment I have an SQL database with many users. But from now on I want to get the users automatically from active directory. Is this possible and/or has anyone an example??   Many many thx in advance!! Yes, it is possible. I would write a console application for that. You need to add reference directorySer...

how to get Full Name of user from Active Directory
I'm using issue starter kit ver .Net framework 1.1In the namespace: ASPNET.StarterKit.IssueTracker.BusinessLogicLayer.ITUser.GetDisplayNameWhen i try using string g = User.Identity.Name;Response.Write("" + GetDisplayName(g));It doesn't return the users full name to me but only the User.Identity.NameIS it because 'm not setting the LDAP path? Or it isn't working???private const string _activeDirectoryPath = @"GC://";private const string _filter = "(&(ObjectClass=Person)(SAMAccountName={0}))";private const string _windowsSAMPath = @"WinNT:...

How to get the canonical name of a user in active directory programaticaly
Hello, I need to get the canonical name of a user from my 2.0 web project, Can anyone help?Thanks. Ok.  In order to get anything from the AD you'll need to do the following.  (Using C#) //Make a DirectoryEntry Object. DirectoryEntry de = new DirectoryEntry(LDAP://your.domain); //Use this to make a DirectorySearcher Object DirectorySearch ds = new DirectorySearcher(de); //Specify the account you want with the .Filter on the ds. ds.Filter = "sAMAccount = " + username-you-want-the-info-for; //Add the properties you want to load.  The Canonical Na...

Using VB: how to get users in a role in Active Directory?
Hi All I can, with code obtained from these pages, get a list of roles for a user in the Active Directory. This is useful for allowing access to the College information system for a user who is identified as STAFF. What I would like to do also is, for the administrator, get a list of the users in a particular role. This will then be used to link to a table in MSSQL server which will control their access to the various Faculties right down to departmental access. Thanks in advance Instamatix...

[Help] Get user email address from Active Directory
Hi all, I've very new to and to AD. I'm looking for a way to get a users email address from active directory. I've done some reserch and it's just confusing me As far as i can tell I connect to AD with LDAP. some articles i've seen say i need to get the username (which i've got) and then query my exchange server some don't I've very confused as they all seem to require a slightly higher level of knowleage about AD than I have can anyone clear the mist up a bit or point me in the right direction Thanks in advance - Elfman &...

Can I Get Information About User By IP in Active Directory?
Hi, A user who is on the same domain as server and also logged on to that domain too, come to my web site, web site is on Windows Server 2003, i got his IP, Can i get his logged in name on domain by IP? Yasir Hi, This isn't something that will be stored in AD anywhere. If the user is still logged in you can use on of the fantastic tools available from SysInternals. The tool is PsLoggedOn and can be downloaded from here. Cheers Dave ...

using Membership class to get the list of users in a Active Directory group
 Hi,Can we use Membership class to get the list of all users that are part of an Active Directory group ? Thanks a lot, I appreciate your taking the time to help me....

Get user's first and last name from Active directory.
Hi,I'm trying to get user's first and last name from AD to display in my welcome page. I'm using Visual Studio 2005. In my login page I have login control and I'm using forms authentication against LDAP.So I don't have to store user data. Any help would be greatly appreciated.   DirectoryEntry objOU = new DirectoryEntry(",%20DC=domain,%20DC=something,%20DC=net%20or%20com>/">LDAP://CN=your user name, OU=users group>, DC=domain, DC=something, DC=net or com"); string name = objOU.Properties["givenName"].Value.ToString(); string...

How to get windows log-in user name using code?
Hi, I built an web application on our companies HR system so that recruitors can post jobs. Is there a way to get the windows logged in user name using code? This user name is using for tracking who posted the job. Thank you.   Windows Authentication provides some options, as does forms authentication.  See if you get what you need through User.Identity.Name.  Take a look at: JeffPlease: Don't forget to click "Mark as Answer" on the p...

How to get IP address using Email Address
Hi, I want to know that how can i get actual IP address of a person who is using the email address like gmail, yahoo, msn, etc. If user enter the email address of the any person, it should return the actual IP Address of that person computer which is he connect. Is this possible? Any reference will be apperciated. Guide me............  This is not possible because email address is not related with IP address, Domain names are Mohamed Abb@s------------------------Please remember to click “Mark as Answer” on the post(s) which helps you ! Threre's no correlation between IP...

Web resources about - Is it possible to get user name from active directory using IP address? -

Wikipedia:Quick directory - Wikipedia, the free encyclopedia
This page is a handy directory to various locations of interest in Wikipedia. Only dynamic pages should be listed here, no policy pages etc. ...

Wikipedia:WikiProject Council/Directory - Wikipedia, the free encyclopedia
Wikipedia® is a registered trademark of the Wikimedia Foundation, Inc. , a non-profit organization.

Business Directory Listings: Eight Smart Tips for You to Get Started
If you are considering a business directory listing for your small business, congratulations – you are on the right track. Local SEO, local customers, ...

LinkedIn Lookup iOS app aims to replace your company’s awful intranet employee directory
... continue reading at 9to5Mac . What do you think? Discuss "LinkedIn Lookup iOS app aims to replace your company’s awful intranet employee directory" ...

Atlas Partner Directory Launched
... just for Facebook and Instagram –advertising platform Atlas has one, as well. On that note, Atlas Tuesday introduced the Atlas Partner Directory ...

Slack announces App Directory store
... create more apps for the store, and a new framework called Botkit which should simplify the process of creating apps. The Slack App Directory, ...

The British Library’s ‘Save Our Sounds’ Program Creates Directory of UK Sound Collections
The long-feared deterioration of the world's sound collections is a coming to a head with the British Library's last-ditch initiative called ...

Researchers show how to steal Windows Active Directory credentials from the Internet
... showed at the Black Hat security conference. The attack, called an SMB relay, causes a Windows computer that's part of an Active Directory ...

Researchers find way to steal Windows Active Directory credentials from the Internet
The technique could enable attackers to attack Windows servers hosted in the cloud

Slack's App Directory proves it's more than just a chatroom
... are about to get a little easier to find and integrate within your team and over 160 of them live within the company's new Slack App Directory. ...

Resources last updated: 1/21/2016 9:45:27 AM