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.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Zoran HorvatPosted Jul 13, 2011, 8:22 AM
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
maheshPosted Jul 13, 2011, 8:42 AM
Zoran HorvatPosted Jul 13, 2011, 8:39 AM
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
Yogesh JaiswalPosted Jul 13, 2011, 8:31 AM
String PrmStrIPAddress = String.Empty;
String strHostName = System.Net.Dns.GetHostName();
PrmStrIPAddress = System.Net.Dns.GetHostAddresses(strHostName).GetValue(1).ToString();
maheshPosted Jul 13, 2011, 8:01 AM
Zoran HorvatPosted Jul 13, 2011, 7:26 AM
Please don't forget to tick the "This is correct answer" checkbox if solution worked for you.
Zoran
maheshPosted Jul 13, 2011, 7:13 AM
Zoran HorvatPosted Jul 13, 2011, 7:06 AM
Zoran
maheshPosted Jul 13, 2011, 7:03 AM
Zoran HorvatPosted Jul 13, 2011, 7:01 AM
Zoran