How to block http file transfer

H

hon123456

Dear all,
I am new to internet programming. Now I want to write a
program with c# that can block or allow download files when user using
browser to download a file. So any beginning site or books introduced
to me to learn . Thanks.
 
A

Arne Vajhøj

I am new to internet programming. Now I want to write a
program with c# that can block or allow download files when user using
browser to download a file. So any beginning site or books introduced
to me to learn.

If you mean any user, then it is not possible.

If you mean a user on the same PC, then it is possible,
but does not make much sense - there must be better ways
to control downloads than hooking into browsers.

And besides C# is probably not the optimal language to
hook into the most common browsers as they are native code.

Arne
 
B

bradbury9

El miércoles, 3 de octubre de 2012 05:03:23 UTC+2, hon123456 escribió:
Dear all,

I am new to internet programming. Now I want to write a

program with c# that can block or allow download files when user using

browser to download a file. So any beginning site or books introduced

to me to learn . Thanks.

I would look into windows firewall api.
c# code using COM Interop http://www.shafqatahmed.com/2008/01/controlling-win.html
MSDN Firewall reference: http://msdn.microsoft.com/en-us/library/aa366453(VS.85).aspx
 
H

hon123456

Thanks bradbury9,

I have checked the MSDN Firewall reference, but I
cannot figure out how to block the http file download in C#. Can u
suggest some hints or provide me some tutorial on how to block the
http file download in C#.

Thanks.
 
B

bradbury9

El miércoles, 3 de octubre de 2012 12:02:43 UTC+2, hon123456 escribió:
Thanks bradbury9,



I have checked the MSDN Firewall reference, but I

cannot figure out how to block the http file download in C#. Can u

suggest some hints or provide me some tutorial on how to block the

http file download in C#.



Thanks.

There are some alternatives:
- Firefox (plugin) or Internet explorer (BHO). Those are not related to c# but could be the easiest to implement.
- Hook into firefox/IE as Arne mentioned. Kinda hard, antivirus could prevent the hook, c# may not be the best language to use (Arne already said that).
- Windows firewall API. To block specific http trafic (block some content but not all http trafic) you would need to do Deep Packet Inspection (DPI). Honestly, dont know if that can be accomplished using windows firewall API because never used it.
- In the router or firewall create a new DPI rule. It depends on your router capabilities. Most domestic ADSL routers have no DPI at all.
 
B

bradbury9

El miércoles, 3 de octubre de 2012 16:27:10 UTC+2, Peter Duniho escribió:
The officially supported way to do that would be to write a Layered Service
Provider using the Winsock API.

If I recall correctly the fiddler proyect does inject that way, maybe checkfiddler project people?
I don't know if it's even possible to do that with managed code,
but for sure it would be a lot less of a hassle to do it using C/C++.

Totally agree with Pete :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top