[image]  

[image]  
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support |  [image]
User Name:
Password:
Remember me
Reload this Page

Get the correct IP address

[image] Record onscreen activity, your voice & webcam video. Turn everyday presentations into HD-quality videos.

For perfectly clear screencasts every time.
[image] Build the right apps the right way with powerful development tools.

Visual Studio 2010. Learn more.
[image]

Take your business to the next level, with "The Edge of Success: 9 Building Blocks to Double Your Sales." Inside, you will discover how to easily capture more leads, get repeat sales, and significantly grow your business.


Reply
Add This Thread To:
 [image]Del.icio.us  [image]Digg  [image]Google  [image]Spurl  [image]Blink  [image]Furl  [image]Simpy  [image]Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old July 10th, 2009, 08:20 AM
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2004
Posts: 115 ccc User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 14 h 40 m 11 sec
Reputation Power: 7
Get the correct IP address

hi

I'm using this code:
Code:
<%=Request.ServerVariables("REMOTE_ADDR")%>
in the .asp webpage installed on the WIN2000 webserver to show via browser the internal IP address from the workstations.
Normally works, but the problem is, sometimes it shows proxy IP address instead of the workstation.
Howto solve this problem?

Last edited by ccc : July 10th, 2009 at 08:26 AM.

Reply With Quote
  #2  
Old July 10th, 2009, 01:27 PM
Grumpier Old Moderator
Dev Shed God 16th Plane (12500 - 12999 posts)
 
Join Date: Jun 2003
Posts: 12,514 Doug G User rank is General 20th Grade (Above 100000 Reputation Level)Doug G User rank is General 20th Grade (Above 100000 Reputation Level)Doug G User rank is General 20th Grade (Above 100000 Reputation Level)Doug G User rank is General 20th Grade (Above 100000 Reputation Level)Doug G User rank is General 20th Grade (Above 100000 Reputation Level)Doug G User rank is General 20th Grade (Above 100000 Reputation Level)Doug G User rank is General 20th Grade (Above 100000 Reputation Level)Doug G User rank is General 20th Grade (Above 100000 Reputation Level)Doug G User rank is General 20th Grade (Above 100000 Reputation Level)Doug G User rank is General 20th Grade (Above 100000 Reputation Level)Doug G User rank is General 20th Grade (Above 100000 Reputation Level)Doug G User rank is General 20th Grade (Above 100000 Reputation Level)Doug G User rank is General 20th Grade (Above 100000 Reputation Level)Doug G User rank is General 20th Grade (Above 100000 Reputation Level)Doug G User rank is General 20th Grade (Above 100000 Reputation Level)Doug G User rank is General 20th Grade (Above 100000 Reputation Level) 
Time spent in forums: 1 Month 1 Week 5 Days 13 h 55 m 12 sec
Reputation Power: 2341
Quote:
Originally Posted by ccc
hi

I'm using this code:
Code:
<%=Request.ServerVariables("REMOTE_ADDR")%>

in the .asp webpage installed on the WIN2000 webserver to show via browser the internal IP address from the workstations.
Normally works, but the problem is, sometimes it shows proxy IP address instead of the workstation.
Howto solve this problem?
You can't always get a reliable ip address from the web server.
__________________
======
Doug G
======
I didn't attend the funeral, but I sent a nice letter saying I approved of it. --Mark Twain

Reply With Quote
  #3  
Old July 10th, 2009, 02:34 PM
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2004
Posts: 115 ccc User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 14 h 40 m 11 sec
Reputation Power: 7
Quote:
Originally Posted by Doug G
You can't always get a reliable ip address from the web server.


but I don't need ip address from the web server, I need the address from the workstation.

Reply With Quote
  #4  
Old July 10th, 2009, 09:31 PM
Grumpier Old Moderator
Dev Shed God 16th Plane (12500 - 12999 posts)
 
Join Date: Jun 2003
Posts: 12,514 Doug G User rank is General 20th Grade (Above 100000 Reputation Level)Doug G User rank is General 20th Grade (Above 100000 Reputation Level)Doug G User rank is General 20th Grade (Above 100000 Reputation Level)Doug G User rank is General 20th Grade (Above 100000 Reputation Level)Doug G User rank is General 20th Grade (Above 100000 Reputation Level)Doug G User rank is General 20th Grade (Above 100000 Reputation Level)Doug G User rank is General 20th Grade (Above 100000 Reputation Level)Doug G User rank is General 20th Grade (Above 100000 Reputation Level)Doug G User rank is General 20th Grade (Above 100000 Reputation Level)Doug G User rank is General 20th Grade (Above 100000 Reputation Level)Doug G User rank is General 20th Grade (Above 100000 Reputation Level)Doug G User rank is General 20th Grade (Above 100000 Reputation Level)Doug G User rank is General 20th Grade (Above 100000 Reputation Level)Doug G User rank is General 20th Grade (Above 100000 Reputation Level)Doug G User rank is General 20th Grade (Above 100000 Reputation Level)Doug G User rank is General 20th Grade (Above 100000 Reputation Level) 
Time spent in forums: 1 Month 1 Week 5 Days 13 h 55 m 12 sec
Reputation Power: 2341
I mean the webserver (where your asp code is running) can't always return the workstations IP reliably. So there is no answer to your question that I know.

Reply With Quote
  #5  
Old July 11th, 2009, 05:41 PM
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2009
Posts: 148 webhostingdir User rank is Second Lieutenant (5000 - 10000 Reputation Level)webhostingdir User rank is Second Lieutenant (5000 - 10000 Reputation Level)webhostingdir User rank is Second Lieutenant (5000 - 10000 Reputation Level)webhostingdir User rank is Second Lieutenant (5000 - 10000 Reputation Level)webhostingdir User rank is Second Lieutenant (5000 - 10000 Reputation Level)webhostingdir User rank is Second Lieutenant (5000 - 10000 Reputation Level)webhostingdir User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 1 Day 3 h 34 m 53 sec
Reputation Power: 57
Code:
<%=Request.ServerVariables("REMOTE_ADDR")%>


This returns the IP address of the visitor's computer. If your visitor is viewing your website from Proxy then it is sure that you wont get his real IP address(ISP's)

Reply With Quote
  #6  
Old July 13th, 2009, 07:36 AM
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2009
Posts: 12 kirank User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 9 h 27 m 12 sec
Reputation Power: 0
Quote:
Originally Posted by webhostingdir
Code:
<%=Request.ServerVariables("REMOTE_ADDR")%>



This returns the IP address of the visitor's computer. If your visitor is viewing your website from Proxy then it is sure that you wont get his real IP address(ISP's)


in asp.net u can find out if customer is using Proxy server.

Code:
if (Context.Request.ServerVariables["HTTP_VIA"] != null) 
            {
                IP = Context.Request.ServerVariables["HTTP_X_FORWARDED_FOR"].ToString();
            }
            else
            {
               IP = Context.Request.ServerVariables["REMOTE_ADDR"].ToString();
            }


hope this will helps you.

Reply With Quote
  #7  
Old July 13th, 2009, 06:11 PM
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2009
Posts: 148 webhostingdir User rank is Second Lieutenant (5000 - 10000 Reputation Level)webhostingdir User rank is Second Lieutenant (5000 - 10000 Reputation Level)webhostingdir User rank is Second Lieutenant (5000 - 10000 Reputation Level)webhostingdir User rank is Second Lieutenant (5000 - 10000 Reputation Level)webhostingdir User rank is Second Lieutenant (5000 - 10000 Reputation Level)webhostingdir User rank is Second Lieutenant (5000 - 10000 Reputation Level)webhostingdir User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 1 Day 3 h 34 m 53 sec
Reputation Power: 57
I have tested your code. But on both cases(1st ISP's IP, 2nd Proxy), "else" statements are executed. Can you advice?

Reply With Quote
  #8  
Old July 13th, 2009, 09:19 PM
E-Oreo's Avatar
Contributing User
Click here for more information.
 
Join Date: Dec 2004
Posts: 3,799 E-Oreo User rank is General 30th Grade (Above 100000 Reputation Level)E-Oreo User rank is General 30th Grade (Above 100000 Reputation Level)E-Oreo User rank is General 30th Grade (Above 100000 Reputation Level)E-Oreo User rank is General 30th Grade (Above 100000 Reputation Level)E-Oreo User rank is General 30th Grade (Above 100000 Reputation Level)E-Oreo User rank is General 30th Grade (Above 100000 Reputation Level)E-Oreo User rank is General 30th Grade (Above 100000 Reputation Level)E-Oreo User rank is General 30th Grade (Above 100000 Reputation Level)E-Oreo User rank is General 30th Grade (Above 100000 Reputation Level)E-Oreo User rank is General 30th Grade (Above 100000 Reputation Level)E-Oreo User rank is General 30th Grade (Above 100000 Reputation Level)E-Oreo User rank is General 30th Grade (Above 100000 Reputation Level)E-Oreo User rank is General 30th Grade (Above 100000 Reputation Level)E-Oreo User rank is General 30th Grade (Above 100000 Reputation Level)E-Oreo User rank is General 30th Grade (Above 100000 Reputation Level)E-Oreo User rank is General 30th Grade (Above 100000 Reputation Level)  Folding Points: 945 Folding Title: Novice Folder
Time spent in forums: 3 Weeks 5 Days 4 h 57 m 54 sec
Reputation Power: 2986
Not all proxies will send you the forwarded IP - if they don't, it's impossible for you to get.

Reply With Quote
  #9  
Old July 14th, 2009, 08:47 AM
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2004
Posts: 115 ccc User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 14 h 40 m 11 sec
Reputation Power: 7
Quote:
Originally Posted by kirank
in asp.net u can find out if customer is using Proxy server.

Code:
if (Context.Request.ServerVariables["HTTP_VIA"] != null) 
            {
                IP = Context.Request.ServerVariables["HTTP_X_FORWARDED_FOR"].ToString();
            }
            else
            {
               IP = Context.Request.ServerVariables["REMOTE_ADDR"].ToString();
            }



hope this will helps you.


thx, I'll try but howto put this code to asp webpage?

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreASP Programming > Get the correct IP address



Thread Tools 
Search this Thread 

Rate This Thread 
 Excellent
 Good
 Average
 Bad
 Terrible

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump



 
Create the Optimal Architecture for your Critical Applications
Warburton's the largest independently owned bakery in the UK faced a number of difficult challenges in providing the most robust yet efficient IT infrastructure for their organization's success. IBM's services combined with their xSeries servers created the perfect platform for their SAP environment with sufficient flexibility, and did so in very time effective fashion.

 
Five Best Practices for Deploying a Successful Service-Oriented Architecture
This white paper describes the benefits you can expect with SOA, and how IBM can help take your business there.

 
Gartner Magic Quadrant for Application Delivery Controllers
Gartner summarizes its view on Application Delivery Controllers, evaluates strengths and weaknesses of solutions, and provides Magic Quadrant reporting for a quick comparison across all vendors. Learn from Gartner how you can benefit from an all-in-one device like Citrix NetScaler that delivers the highest levels of availability, performance and security.

 
Knowledge is Power
What you don't know can hurt you, and is likely costing you money and increasing your security risks during an era of scarce resources. This white paper proposes six key strategies that enterprise security managers can use to improve their network defense posture.

 
Rationalizing the Multi-Tool Environment
The rationalized multi-tool approach is flexible, scalable and cost effective. It provides the necessary input to the IT service management business processes. It preserves prior investments in monitoring tools, empowers technologists to select the best tools with which to do their jobs, and enhances effective response to incidents.

 

[image]
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support |  [image]
  
 



© 2003-2010 by Developer Shed. All rights reserved. DS Cluster 9 Hosted by Hostway
For more Enterprise Application Development news, visit eWeek


You are viewing a mobilized version of this site...
View original page here

Mobilized by Mowser Mowser