HttpHandler, TCP Port ?
Hi everyone,
I have a HttpHandler in wich I need to know the tcp source port of the request. As much as I figured out I need to access the HttpWorkerRequest.GetRemotePort() .
I made several attempts but everytime it returns 0.
first try:
void IHttpHandler.ProcessRequest(HttpContext context)
{
BindingFlags _WorkerBinding =BindingFlags.Instance|BindingFlags.Public|Binding Flags.NonPublic;
HttpWorkerRequest _WorkerRequest = (HttpWorkerRequest)
context.GetType().GetProperty("WorkerRequest",
_WorkerBinding).GetValue(context, null);
int _ReqTcpPort = _WorkerRequest.GetRemotePort();
...
}
second try:
void IHttpHandler.ProcessRequest(HttpContext context)
{
IServiceProvider _Provider = (IServiceProvider) context;
HttpWorkerRequest _WorkerRequest =
(HttpWorkerRequest) _Provider.GetService(typeof(HttpWorkerRequest));
int _ReqTcpPort = _WorkerRequest.GetRemotePort();
...
}
how can I get access to the properties (tcp source port) of the underlying connection ???
thanks in advance,
Martin
|