Click here to Skip to main content
15,891,895 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
hi experts
i get into trouble,its too essential for me
i want computer name of user that connect to my web site in our intranet of company but because there is isa service ,every computer gets isa ip,and i cant get with asp.net client computer ip.do you have a solution with jQuery,Javascript or every things that can helps ms
thanks in advance
Posted

Dear,

I think it will surely help U
XML
<!-- Require jQuery / Anyversion -->
<script language="Javascript" type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<!-- Require EasyJQuery After JQuery -->
<script language="Javascript" type="text/javascript" src="http://api.easyjquery.com/easyjquery.js"></script>

<script language="Javascript">
    // 1. Your Data Here
    function my_callback(json) {
        alert("IP :" + json.IP + " nCOUNTRY: " + json.COUNTRY);
    }

    function my_callback2(json) {
        // more information at http://api.easyjquery.com/test/demo-ip.php
        alert("IP :" + json.IP + " nCOUNTRY: " + json.COUNTRY + " City: " + json.cityName + " regionName: " + json.regionName);
    }

    // 2. Setup Callback Function
   // EasyjQuery_Get_IP("my_callback"); // fastest version
    EasyjQuery_Get_IP("my_callback2","full"); // full version

</script>
 
Share this answer
 
v2
Comments
zinajoonjooni 17-Jul-12 5:51am    
it was helpful,thank you so much ,you are so kind.thanks a lot that you spend your time for my question Dear Suvabrata Roy.
Suvabrata Roy 17-Jul-12 7:10am    
:)
XML
<script language="c#" runat="server">


       void BtnCheck_Click(Object sender,EventArgs e)
    {
        try
        {
        LblHostName.Text = "";
        IPAddress myIP = IPAddress.Parse(TxtInput.Text);

        IPHostEntry GetIPHost = Dns.GetHostByAddress(myIP);

        LblHostName.Text = "Host Name is: " + GetIPHost.HostName;

        }
        catch(Exception ex)
        {
            LblHostName.Text = "<font color=red>Error:" + ex.Message;
        }
        }

        </script>


You can try this ...
 
Share this answer
 
Comments
zinajoonjooni 17-Jul-12 5:04am    
thanks you again
but what is into txtinput.txt?is it IP?i want when user connects to my site my program gets ip of computer's client?
Suvabrata Roy 17-Jul-12 5:14am    
foreach (IPAddress ip in GetIPHost.AddressList)
{
if (ip.AddressFamily == AddressFamily.InterNetwork)
{
LblHostName.Text = ip.ToString();
}
}
zinajoonjooni 17-Jul-12 5:31am    
my problem is that i can't get ip of client computer ,because when user connects to website i get isa ip not client computer IP,how i can get client computer IP dear Suvabrata Roy?
thank you so much
Suvabrata Roy 17-Jul-12 5:41am    
http://www.easyjquery.com/detect-get-clients-ip-address-country-using-javascript-php/
JavaScript
function GetComputerName()
{
    try
    {
        var network = new ActiveXObject('WScript.Network');
        // Show a pop up if it works
        alert(network.computerName);
    }
    catch (e) { }
}



It may or may not require some specific security setting setup in IE as well to allow the browser to access the ActiveX object

ere is a link to some more info on WScript Click Here
 
Share this answer
 
Comments
zinajoonjooni 17-Jul-12 3:57am    
thank you so much ,but if i use ActiveX,it shows pop up message to user and user dont allow this pop pub.dose it work in any way?
do you have another solution?
Suvabrata Roy 17-Jul-12 4:29am    
<pre lang="xml"><script language="c#" runat="server">


void BtnCheck_Click(Object sender,EventArgs e)
{
try
{
LblHostName.Text = "";
IPAddress myIP = IPAddress.Parse(TxtInput.Text);

IPHostEntry GetIPHost = Dns.GetHostByAddress(myIP);

LblHostName.Text = "Host Name is: " + GetIPHost.HostName;

}
catch(Exception ex)
{
LblHostName.Text = "<font color=red>Error:" + ex.Message;
}
}

</script></pre>

You can try this ...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900