Click here to Skip to main content
15,887,344 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
See more:
I used payment gateway in my site.I want to allow just some IP for storing data, so
I want to get responsed url ip address for security.I want to get IP Address of responsed url. When I come back to my site from gateway I want to check responsed IP address(getway IP Address).
Posted
Comments
Sergey Alexandrovich Kryukov 21-Mar-13 15:46pm    
What is "responsed URL" is not quite clear.
—SA
jkirkerx 21-Mar-13 15:47pm    
Your question makes no sense to me.

You want the IP address of the customer that is processing their payment?

Or the IP Address of the Payment Gateway that processed your payment?

if the latter, they the IP Address is the resolution of the url you transmitted your request to.
Sergey Alexandrovich Kryukov 21-Mar-13 15:54pm    
I totally agree. Nevertheless, I provided just the pretty general answer, so OP could figure out what's really needed. Please see.
(Actually, I don't see why IP address is really needed; the inquirers always should explain their ultimate goals. In case the request makes no sense, a useful advice still can be given.)
—SA
jkirkerx 21-Mar-13 16:13pm    
I write credit card software, and I didn't understand the need for the ip address, except for submission to a payment gateway like paypal pro.

Well, you beat me to the punch on this question, but did a better faster job at answering the question. I think you hit the nail on the head.

I have a private question for you, will side channel it.

1 solution

Please see my comment to the question.

If you have some URI and want to know IP address, there is no one-to-one correspondence, as any host can serve multiple IP addresses. This is not related to ASP.NET or HTTP and is the responsibility of DNS.

For example:
C#
System.Net.IPAddress[] addresses = System.Net.Dns.GetHostAddresses("www.CodeProject.com");


Note, this is an array of IP addresses, not just one.

If you need to get an IP address of the client, more exactly, of the HTTP request (not response, as you always know it on the server side and it is not actually used), you can use HttpRequest.ServerVariables["REMOTE_ADDR"];
http://msdn.microsoft.com/en-us/library/system.web.httprequest.servervariables.aspx[^].

Please see also: http://www.w3schools.com/asp/coll_servervariables.asp[^].

—SA
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900