Click here to Skip to main content
15,891,316 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have monitored the network traffic using C#.Net:
what i want now is to Block a suspicious user by blocking IP that is used to perform a suspicious act.

I want to know that how can i block traffic coming from a particular IP,
or how can i drop or block packets using C#.Net.

I do not want to use windows firewall, i basically want to perform these things by Coding them my self in C#.Net.

Is there any Library, Class or any Code in C# that can help me do this please tell me.

your help will be appreciated. :)

Thank you.
Posted

1 solution

You could block anything, but only if your process is put in the middle of the traffic somewhere. If your application could hook itself in the middle by itself, without explicit user's consent, don't you understand that would mean another system vulnerability?

One way of getting into the HTTP stream with user consent would be development of some Web proxy server which should be explicitly put to use by the user. See, for example, this code sample: http://times.imkrisna.com/2011/08/simple-http-proxy-server-c-source-code[^].

See also:
http://stackoverflow.com/questions/226784/how-to-create-a-simple-proxy-in-c[^],
http://bartdesmet.net/blogs/bart/archive/2007/02/22/httplistener-for-dummies-a-simple-http-request-reflector.aspx[^].

Also see this CodeProject article: Implementing a Multithreaded HTTP/HTTPS Debugging Proxy Server in C#[^].

—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