如何获取在浏览器中打开InfoPath表单的客户端的本地IP?
我做了VSTO C#编码,但这不再是浏览器支持了,对吧?你建议我做什么?因为登录我需要本地IP。谢谢。
public string getLocalIp()
{
IPAddress[] localIPs = Dns.GetHostAddresses(Dns.GetHostName());
return localIPs[2].ToString();
}
public string getPublicIP()
{
WebClient webClient = new WebClient();
string IP = webClient.DownloadString("http://myip.ozymo.com/");
return IP;
}
// OPOMBA: program Microsoft Office InfoPath zahteva ta postopek.
// Lahko ga spremenite s programom Microsoft Office InfoPath.
public void InternalStartup()
{
root.SelectSingleNode("/my:getRacInfo/my:localIp", NamespaceManager)
.SetValue(getLocalIp());
//string ipAddress = HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"];
root.SelectSingleNode("/my:getRacInfo/my:webIp", NamespaceManager)
.SetValue(getPublicIP());
}`