Hmm - IIRC this is an entirely randomportpicked from a pool of available
ports between something like 1024 and 65536, but I don't think there's any
way of finding out its number through the standard HttpRequest /
HttpResponse connectivity.
AAMOI, what possible use could this number be to you...?
To answer your question -- The remote port can be used to determine the
machine that a request was originally routed from behind a NAT enabled
router. When NAT is used, all requests behind a router appear to come
from the same IP address. The only thing that differs is the port
number. NAT uses the port number to route the request back to the
proper machine on the private subnet.
In response to previous posts, the request would rarely be sent back to
the client on port 80 or 443. These ports would only be open on the
server machine. In fact, some personal firewalls would block these
ports entirely on a client PC. Usually the client initiates the
request and chooses a random high number port for its side of the
socket and connects to a known port on the server (80,443). When the
response is returned from the server it it sent back via the high
numbered client port for which it originated. You can observe this by
running "netstat -N" from the command line on a web server. It will
show all open client connections to the web server. You will see the
high numbered remote ports with the client address and standard ports
80 and 443 on the server side. Hope this clears up the port
confusion.
From the responses so far, it sounds like there is no easy way to
access this information via ASP.net.