Dear all,
Suppose i have hosted appl.if any client system access that hosted appl then i want to store that client ip in the server side.How can i do that?Help me.
Thanks
Loading
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Zoran HorvatRank #792 · 2.9K reputationPosted Jul 13, 2011, 4:22 AM EDT
ping -v 4 localhost
That would show address 127.0.0.1.
Try to contact your ASP page from another computer, if possible. Otherwise, you may contact it from virtual machine installed on the same computer, as that host would receive another IP address for itself.
Anyway, 127.0.0.1 is a correct result of the UserHostAddress property when connecting from the same computer.
Zoran
Zoran HorvatRank #792 · 2.9K reputationPosted Jul 13, 2011, 3:01 AM EDT
Zoran
mahesh112 reputationPosted Jul 13, 2011, 3:03 AM EDT
Zoran HorvatRank #792 · 2.9K reputationPosted Jul 13, 2011, 3:06 AM EDT
Zoran
mahesh112 reputationPosted Jul 13, 2011, 3:13 AM EDT
Zoran HorvatRank #792 · 2.9K reputationPosted Jul 13, 2011, 3:26 AM EDT
Please don't forget to tick the "This is correct answer" checkbox if solution worked for you.
Zoran
mahesh112 reputationPosted Jul 13, 2011, 4:01 AM EDT
Yogesh JaiswalRank #1,718 · 884 reputationPosted Jul 13, 2011, 4:31 AM EDT
String PrmStrIPAddress = String.Empty;
String strHostName = System.Net.Dns.GetHostName();
PrmStrIPAddress = System.Net.Dns.GetHostAddresses(strHostName).GetValue(1).ToString();
Zoran HorvatRank #792 · 2.9K reputationPosted Jul 13, 2011, 4:39 AM EDT
That would give you (the first) address of the local computer, but question was how to get remote client address. Even when doing this operation as you stated, you should test address types and then return specific kind of address, e.g. IPv4 address which is easier to read.
Zoran
mahesh112 reputationPosted Jul 13, 2011, 4:42 AM EDT