Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

We are using the Microsoft SharePoint Server 2007 in our company environment. How can I display user's computer information who has logged in to SharePoint?

I want to do something like this:

Computer Name:test
The Ip Address:192.168.x.x
Domain : xxx.com
The MAC Address:02.2d.xx.xx.xx  
share|improve this question
    
Welcome to SharePoint.SE! You have a great question here, but I made some slight improvements based on our guidelines. You can also read How to Ask for more general guidelines. –  Kit Menke Jul 14 '11 at 14:02
    
@Kit Menke-thanks for your info.I will be more careful. –  Cell-o Jul 14 '11 at 14:05
    
Can I ask what's the use case for this - why do you want to display it? Isn't it the equivalent of an answer machine reading out my own telephone number wean I call it; thanks, but I already know my own number ;) –  Ryan Jul 14 '11 at 15:16

2 Answers 2

up vote 1 down vote accepted

Depending on the network configuration, all this information could be available to you. I assume you are making web part for intranet users. This is how you can get IP address and full computer name (computer name + domain):

string ipAddress = this.Page.Request.UserHostAddress;
string fullComputerName = System.Net.Dns.GetHostEntry(this.Page.Request.UserHostAddress).HostName;

From there you should be able to parse computer name and domain, if you wish so.

For example how to get MAC address of remote computer you can check this answer for question: Reliable method to get machine's MAC address in C#.

Limitations are:

  1. You will be able to get client's IP only if server and client are on the same network. Otherwise, you will see only proxy/gateway IP address.
  2. You won't be able to get full computer name if your DNS does not support reverse lookup. Also, if client and server are on different networks, this could be a problem too.
  3. Sending ARP packets could also be blocked.
share|improve this answer

Just to clarify - you're talking about returning the details of the users own computer right?

In this case if your code is running on the server as a web part then the only thing you're going to be able to provide is the IP address - nothing else is available remotely.

Think about the security implications if this were so - no need for cookies, every website on earth would know your MAC address (totally unique), computer name, company domain etc etc.

If you really need this (and I can't for the life of me imagine the use case for this above a "You last logged on at such a time from ip xxx") then you need to have a program running on the client (users) side - ActiveX/Java/Silverlight - but I would expect they are also restricted (esp Java/Silverlight) in getting this sort of info.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.