Results 1 to 3 of 3

Thread: How to get other IP address

  1. #1
    Join Date
    Jan 2009
    Posts
    86

    How to get other IP address

    Hi friends,

    I want to get my client ip address as soon as they access my web-site which is built in asp.net.Along with that i want to store it in my database.I have heard from my friends that it's possible but don't know how to do it.

    Can anyone help me out with this issue.

    Intel Dual core 2.66 Ghz
    Gigabyte 780 with Intel Chipset
    2gb ram
    300 gb HDD

  2. #2
    Join Date
    May 2008
    Posts
    2,297

    Re: How to get other IP address

    Sure i will help you out with this you need use the following code

    HTML Code:
    Imports System.Net.Sockets 
    Imports System.Reflection
    
    Public NotInheritable Class ClientConnection 
    Implements IDisposable       
       Private Client As TcpClient
       Private PublicIP As String
    
       
    
    
       Public Sub New(ByVal client As TcpClient)
         
    
            If client Is Nothing Then
               Throw New ArgumentNullException("client")
            End If
            Me.Client = client   
       End Sub
    
    #Region " IDisposable Support "
       Private disposedValue  As Boolean ' To detect redundant calls
    
       Private Sub Dispose(ByVal disposing As Boolean)      
          If Not Me.disposedValue Then         
             If disposing Then            
               
    
                   If Not Client Is Nothing Then                  
                      Client.Close()                  
                      Client = Nothing               
                   End If         
             End If         
            
    
          End If
          Me.disposedValue = True   
       End Sub
    
       Public Sub Dispose() Implements IDisposable.Dispose      
          
    
          
    
          Dispose(True)      
          GC.SuppressFinalize(Me)
       End Sub
    #End Region
    
    End Class

  3. #3
    Join Date
    May 2008
    Posts
    3,316

    Re: How to get other IP address

    I have try to use the it worked

    HTML Code:
    string ip;
    
    ip=Request.ServerVariables("HTTP_X_FORWARDED_FOR") ;
    if(ip==string.Empty)
    {
    ip=Request.ServerVariables("REMOTE_ADDR");
    }
    REMOTE_ADDR does not always provide the users IP but rather the ISPs' IP address so first test HTTP_X_FORWARDED_FOR as this one is the real user IP.

Similar Threads

  1. Google chrome is not displaying the address in the address bar
    By Siketan in forum Technology & Internet
    Replies: 4
    Last Post: 23-03-2011, 04:13 AM
  2. Specific IP address changing TCP IPv4 DNS server address
    By Poks in forum Networking & Security
    Replies: 4
    Last Post: 11-01-2011, 06:05 AM
  3. Bypass Export address table Address Filter (EAF)
    By Dwarner in forum Software Development
    Replies: 4
    Last Post: 25-12-2010, 08:06 AM
  4. Replies: 2
    Last Post: 16-02-2009, 08:06 PM
  5. Adding new email address to exchange address book
    By RaeS in forum Small Business Server
    Replies: 5
    Last Post: 23-09-2008, 08:24 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,501,887.38590 seconds with 16 queries