aspdotnet-suresh offers articles and tutorials,csharp dot net, articles and tutorials,VB.NET Articles,Gridview articles,code examples of 2.0 /3.5,AJAX,SQL Server Articles,examples of .net technologies

how to get-find ip address of client machine in using jquery

Jul 25, 2012

In this article I will explain how to get or find IP address of client machine in using JQuery.

In previous posts I explained many articles relating to
 JQuery. Now I will explain how to get client machine IP address of client machine in using jquery. To implement this one write the code as shown below

<html xmlns="">
<title>Get Find IP Address of Client machine using JQuery in</title>
<script type="text/javascript" src=""></script>
<script type="text/javascript">
$(function() {
$("#btnSubmit").click(function() {
function(data) {
alert("Your IP Address: " + data.ip);
.error(function() { alert("error"); })
<form id="form1" runat="server">
<asp:button ID="btnSubmit" runat="server" Text="Get IP Address" />
If you observe script in header section here we are calling webservice using JSON calls this service is called as JSONP because we included parameter string “callback=?” in URL.


Your IP Address:

If you enjoyed this post, please support the blog below. It's FREE!

Get the latest,, VB.NET, jQuery, Plugins & Code Snippets for FREE by subscribing to our Facebook, Twitter, RSS feed, or by email.

subscribe by rss Subscribe by RSS subscribe by email Subscribe by Email


Anonymous said...

Hi Suresh,
I tried this URL and it's working gud, but if your system in some domain then it's give me the server IP address not the exact Client IP Address.
Sorry if something is wrong..

Great Work keep doing this.


Anonymous said...

It is giving me the same IP address

Unknown said...

Please Tell Me HOw TO Get The Connection I Got The Display The Error Message.My Code Is :-
using (SqlConnection test = new SqlConnection("Data Source=ANKIT\MSSQLSERVER1;Integrated Security=true;Initial Catalog=demo"))
using (SqlCommand cmdSQL = new SqlCommand("select DISTINCT UserName from auto_table where UserName LIKE '%'+@SearchText+'%'", test))
cmdSQL.Parameters.AddWithValue("@SearchText", username);
SqlDataReader dr = cmdSQL.ExecuteReader();
while (dr.Read())
return result;

Suresh Dasari said...

@patel vipul...
please check your database connection..

Anonymous said...

please give code for webservice in this example

vipin said...

Dear Suresh,
This is not working jquery

Anonymous said...

This is not working jquery

Give your Valuable Comments

Note: Only a member of this blog may post a comment.

© 2015 All Rights Reserved.
The content is copyrighted to Suresh Dasari and may not be reproduced on other websites without permission from the owner.