如何获取在浏览器中打开 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());
}`