Tuesday, June 1, 2010

Find the IP Address of the SharePoint 2007 User

Suppose you have a SharePoint website that is being accessed by a lot of users everyday (~1K users daily).

Now for some reason or the other you want to capture the client IP address of the end user accessing your MOSS web application.

Purposes could be like:

  • Reporting/Logging user IP address
  • Security purposes
  • Filtering content based on the client IP address
  • Getting the location of the user based on the client IP address
  • so on..
You could simply use HttpContext.Current.Request.UserHostAddress to get the IP address of a user.

This could be easily used in both ASP.Net applications as well as SharePoint development projects.

No comments:

LinkWithin

Related Posts with Thumbnails