How to find IP address of user machine in ASP.
-
Hi In my application i want to find ip address of the user machine who is accessing my application.I am develop an application for it but it gives me ip address of my server i.e the server on which my application is running but i want to find out ip address of the machine who is accessing my application.How can i do this using ASP. Please guide me to solve this. Thanks.
Rahul
HttpContext.Current.Request.UserHostAddress
-^-^-^-^-^- no risk no funk ................... please vote ------>
-
OK.. try using: Dim ip as string = Request.UserHostAddress
HI I tried this it gives me following error. Microsoft VBScript runtime error '800a01b6' Object doesn't support this property or method: 'UserHostAddress'
Rahul
-
HI I tried this it gives me following error. Microsoft VBScript runtime error '800a01b6' Object doesn't support this property or method: 'UserHostAddress'
Rahul
Well this is an ASP.NET forum, not VBScript... I suggest you try Googling "client ip address vbscript" and follow up some of the results...
-
Well this is an ASP.NET forum, not VBScript... I suggest you try Googling "client ip address vbscript" and follow up some of the results...
I know this is asp.net forum i have implemented same application using asp.net also when i run the application on local machine it gives me correct ip address and when i am upload this to server and run the page then it also show me server ip address and server name insted my machine name. Ok thanx for u r help.
Rahul
-
I know this is asp.net forum i have implemented same application using asp.net also when i run the application on local machine it gives me correct ip address and when i am upload this to server and run the page then it also show me server ip address and server name insted my machine name. Ok thanx for u r help.
Rahul
Ths may help: (you'll ned to convert ot VB) string ip; ip=Request.ServerVariables("HTTP_X_FORWARDED_FOR"); if(ip==string.Empty) { ip=Request.ServerVariables("REMOTE_ADDR"); } REMOTE_ADDR does not always provide the users IP but rather the ISPs' IP address so first test HTTP_X_FORWARDED_FOR as this one is the real user IP.
-
HttpContext.Current.Request.UserHostAddress
-^-^-^-^-^- no risk no funk ................... please vote ------>
HI i tried this it gives me my server ip address not my machine ip address. again any solution. Thanks.
Rahul
-
Ths may help: (you'll ned to convert ot VB) string ip; ip=Request.ServerVariables("HTTP_X_FORWARDED_FOR"); if(ip==string.Empty) { ip=Request.ServerVariables("REMOTE_ADDR"); } REMOTE_ADDR does not always provide the users IP but rather the ISPs' IP address so first test HTTP_X_FORWARDED_FOR as this one is the real user IP.
Thanx I tried that but the result is same as before.Is there any server setting required for that purpose. Thanks.
Rahul
-
HI i tried this it gives me my server ip address not my machine ip address. again any solution. Thanks.
Rahul
In our web applications this works just fine. Seams that the problem is something different.
-^-^-^-^-^- no risk no funk ................... please vote ------>
-
In our web applications this works just fine. Seams that the problem is something different.
-^-^-^-^-^- no risk no funk ................... please vote ------>
-
Could you please elaborate Where you have hosted your web application. Its localhost or outside ur network??
The web application was hosted on a dedicated server that was accessible locally, or from intranet or over internet. the IP could always be requested in the way I explained some post earlier. However, this was a long time ago, on a different .NET version that today's. Hope that helps...
-^-^-^-^-^-^-^- planetgeek.ch