473,323 Members | 1,570 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,323 software developers and data experts.

getting ip address of client in asp.net

Hi !
I have used "System.Web.HttpContext.Current.Request.UserHostAd dress " and " Request.ServerVariables["REMOTE_ADDR"] ".
But at both times i got only " 127.0.0.1 " WHY ? and what is the code to get te ip address of the clients visiting my website ?
Apr 20 '07 #1
3 6498
RedSon
5,000 Expert 4TB
Hi !
I have used "System.Web.HttpContext.Current.Request.UserHostAd dress " and " Request.ServerVariables["REMOTE_ADDR"] ".
But at both times i got only " 127.0.0.1 " WHY ? and what is the code to get te ip address of the clients visiting my website ?
Are you testing your code from a server running on your local machine? Are you also testing your code from a client running on your local machine? If you are connecting to your sever locally then all you will see is 127.0.0.1. You need to test it from another client that is on a different machine.
Apr 20 '07 #2
radcaesar
759 Expert 512MB
Request.UserHostAddress() will get the client ip
Apr 20 '07 #3
Are you testing your code from a server running on your local machine? Are you also testing your code from a client running on your local machine? If you are connecting to your sever locally then all you will see is 127.0.0.1. You need to test it from another client that is on a different machine.
Ya that right... Now i uploaded the code on server and i got it correctly. Thanks for ur help
Apr 21 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: Chris | last post by:
<apologies for cross-posting> Hi All, I am based in the UK and have been doing some private work for a client which involved setting up a database and scripts to search it and display results...
3
by: roger beniot | last post by:
I would like to figure out how to detect an IP address change for an XP/Win2K3 machine that is leasing an IP via DHCP (and do it in C#)... Is there any event that indicates an IP address...
5
by: Greg Smith | last post by:
I have been using the following to get the client IP address: Request.ServerVariables All of a sudden it has started returning 127.0.0.1 all the time. Does anybody have any idea why this...
4
by: anonymous_c | last post by:
Hey guys. I'm creating a file transfer app. Anyways, I'm using this code... SERVER <code>Dim Hostname As String = Dns.GetHostName Dim IP As String =...
4
by: Andy | last post by:
Hi all, I'm trying to write some code in a business layer which will audit the IP address that the request is coming from. If the business layer is being called from a web app, I'd like to get...
14
by: Ankit Aneja | last post by:
The code of classes given below is for server to which clients connect i want to get ip address of client which has connected pls help how can i get //listen class public class listen {
6
by: Prabhat | last post by:
Hi Friends, It it possible to get the MAC Address of the client PC using ASP. Also can I get the HDD ID/Serial Number also using asp? Please advice. Thanks Prabhat
4
by: Macca | last post by:
Hi, I am using an asynchronous socket server to allow comms between multiple clients and my server. I know how to obtain the IPAddress of the client (network device) as shown below :- string...
1
by: simbarashe | last post by:
Hie could someone please help me with getting and using the current page url. I have a function that gets the url, I want to use it with header(location : XXX) but it wont work. The code is as...
29
pradeepjain
by: pradeepjain | last post by:
Hii, I need to know is there any way to get the mac id's of the machines accessing ma site! I want to make a access lock using the mac id's <?php function returnmacaddress() { //...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.