简体   繁体   中英

How can I retrieve both ipv4 and ipV6 address of the client that makes request to a web page

How can I retrieve both ipv4 and ipV6 address of the client that makes request to a web page in C#?

Suppose the user request pageA.aspx , then what code should I use in the Page_Load event of that C# code-behind file to get this information?

Also I need client port number, server port number.

ipv6 is not yet fully replacing ipv4 , so you won't need that until all the devices and softwares (and of course .net framework) supports that, but if you are eager to be a step further ; you might write a function which converts ipv4 to ipv6 , for example try to clone this : http://www.subnetonline.com/pages/subnet-calculators/ipv4-to-ipv6-converter.php

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM