启用浏览器的InfoPath表单获取客户端的本地IP

时间:2011-01-04 08:11:47

标签: sharepoint-2007 infopath-2007 infopath-forms-services

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

0 个答案:

没有答案