我有一个webpart,它通过一个简单的按钮向SharePoint上的用户显示。单击按钮时,我会记录单击它的用户,时间及其IP地址。我无法弄清楚的是如何找到他们的IP地址?我可以通过SharePoint对象模型实现它还是必须做一些更复杂的事情?
private bool SignInCurrentUser()
{
SPWeb web = SPContext.Current.Web;
SPUser user = web.CurrentUser;
String address = "?";
SPList regList = web.Lists["SEED MEng Lab Registration List"];
SPListItem registration = regList.Items.Add();
registration["Student"] = user;
registration["Occurrence"] = DateTime.Now;
registration["IP Address"] = address;
registration.Update();
return true;
}