We are trying to Integrate with a new Payment gateway provider. In the requirement they need us to verify the IP address from which the payment response is returned.
So in Return method we used following to retrieve IP address:
Would be glad to try and help you out a bit since I have just finished my payment plugin.
Could you elaborate a bit on the flow of this verification ? Do I understand correctly that you make payment request without customer redirection ? Do you need to get the IP in your own controller which is being called in response ?
It is a simple payment plugin in which the user is redirected to payment gateway with required parameters and the payment gateway returns to my controller with specific response. So now I need to know the IP address of this response in my controller.
Please see http://www.geekpedia.com/KB32_How-do-I-get-the-visitors-IP-address.html this page. So you should try the following: 1. Open \src\Presentation\Nop.Web\Web.config 2. Add "ForwardedHTTPheader" app setting with "REMOTE_ADDR" value. Or you can simply replace "X-FORWARDED-FOR" with "REMOTE_ADDR" in the "GetCurrentIpAddress" method of \Libraries\Nop.Core\WebHelper.cs file
Please see http://www.geekpedia.com/KB32_How-do-I-get-the-visitors-IP-address.html this page. So you should try the following: 1. Open \src\Presentation\Nop.Web\Web.config 2. Add "ForwardedHTTPheader" app setting with "REMOTE_ADDR" value. Or you can simply replace "X-FORWARDED-FOR" with "REMOTE_ADDR" in the "GetCurrentIpAddress" method of \Libraries\Nop.Core\WebHelper.cs file
rafPe wrote:
Try this var IP = Request.ServerVariables["REMOTE_ADDR"];
Request.UserHostAddress
No luck yet, all above solutions gives me the same local/User IP address.
When I was debugging it was my local system IP (127.0.0.1). But when I tested it on remote test server, I realised that the IP address was of the User logged in because in this case it was my public IP. So it getting the user IP instead of response server IP.