473,397 Members | 2,116 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,397 software developers and data experts.

Getting IP address

I have an asp.net 1.1 application on our internal web server that logs when
a user logs in and records the ipaddress; however, it is returning the
address of the server, not the user's workstation. How would I get the
user's workstation's ip address, if possible. This is what I'm using now

Dim ip as string
Try
Dim strHostName as String = dns.GetHostName
Dim ipEntry as IPHostEntry = dns.GetHostByName(strHostName)
Dim ipAddress as IPAddress() = ipEntry.AddressList
Dim i as Integer = 0
do while i < ipAddress.Length
ip = ip & " " & i & ": " & strHostName & " " &
IpAddress(i).ToString
i = i+1
Loop
Catch ex as Exception
End try
Jun 27 '06 #1
2 1551
I think in C# its

Request.ServerVariables["REMOTE_ADDR"]

"KatMagic" wrote:
I have an asp.net 1.1 application on our internal web server that logs when
a user logs in and records the ipaddress; however, it is returning the
address of the server, not the user's workstation. How would I get the
user's workstation's ip address, if possible. This is what I'm using now

Dim ip as string
Try
Dim strHostName as String = dns.GetHostName
Dim ipEntry as IPHostEntry = dns.GetHostByName(strHostName)
Dim ipAddress as IPAddress() = ipEntry.AddressList
Dim i as Integer = 0
do while i < ipAddress.Length
ip = ip & " " & i & ": " & strHostName & " " &
IpAddress(i).ToString
i = i+1
Loop
Catch ex as Exception
End try

Jun 27 '06 #2
Hi Kat,

You can use

Request.UserHostAddress

http://msdn2.microsoft.com/en-us/lib...staddress.aspx

Ken
Microsoft MVP [ASP.NET]
"KatMagic" <SS********@yahoo.com> wrote in message
news:OP**************@TK2MSFTNGP04.phx.gbl...
I have an asp.net 1.1 application on our internal web server that logs when
a user logs in and records the ipaddress; however, it is returning the
address of the server, not the user's workstation. How would I get the
user's workstation's ip address, if possible. This is what I'm using now

Dim ip as string
Try
Dim strHostName as String = dns.GetHostName
Dim ipEntry as IPHostEntry = dns.GetHostByName(strHostName)
Dim ipAddress as IPAddress() = ipEntry.AddressList
Dim i as Integer = 0
do while i < ipAddress.Length
ip = ip & " " & i & ": " & strHostName & " " &
IpAddress(i).ToString
i = i+1
Loop
Catch ex as Exception
End try

Jun 28 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Timo | last post by:
I am trying to get address of myStruct to a string array texts. I am using M$ Visual C++ 6.0 (this is not OS specific question, though, this code should also work on 16 bit embedded compiler ;)). ...
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...
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 {
3
by: Adam Tibi | last post by:
Hi, Is there a way of getting the domain name of tghe currently executing site, I tried using this silly code: public static string GetDomainName() { string serverName =...
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: rahulbsbs | last post by:
Sir how can i get the ip address of the remote system by writting a java code,ie i want to get ip address of the remote system that is connected to my server computer ,the ip address must be...
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...
0
kaleeswaran
by: kaleeswaran | last post by:
hi! currently i am doing registration form... i like to getting an ip address from the respective system i mean where the user using my application form, the respective system ip address...
2
by: rustyc | last post by:
Well, here's my first post in this forum (other than saying 'HI' over in the hi forum ;-) As I said over there: ... for a little side project at home, I'm writing a ham radio web site in...
7
vikas251074
by: vikas251074 | last post by:
I am getting error above in following code since few days giving tension day and night. How can I solve this? I am facing since Oct.25. in line no. 362 After doing a lot of homework, I am...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.