Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > .NET > Other .NET > General .NET
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
General .NET For general discussion of MICROSOFT .NET topics that don't fall within any of the other .NET forum subcategories or .NET language forums.  If your question is specific to a language (C# or Visual Basic) or type of application (Windows Forms or ASP.Net) try an applicable forum category. ** PLEASE BE SPECIFIC WITH YOUR QUESTION ** When posting here, provide details regarding the Microsoft .NET language you are using and/or what type of application (Windows/Web Forms, etc) you are working in, if applicable to the question. This will help others answer the question without having to ask.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the General .NET section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old August 22nd, 2004, 11:01 AM
Registered User
 
Join Date: Aug 2004
Location: , , .
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
access of Items[""] collection in Httphandler anujrathi ASP.NET 2.0 Professional 0 November 15th, 2007 08:02 AM
Maximum limit for a TCP/IP Port ashu_from_india General .NET 2 April 20th, 2006 12:15 AM
TCP/IP HELP jpsultana VB.NET 2002/2003 Basics 0 September 29th, 2005 01:37 PM
HttpHandler, TCP Port ? dotnetMe Classic ASP Professional 4 August 22nd, 2004 11:07 AM



All times are GMT -4. The time now is 08:25 AM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.