CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Nov 2013

    Change http request server response?? proxy?

    Is there anyway to make when browser request some file from server than browser to load another file.

    i open http://www.example.com
    so now the browser send http request to load image
    so when browser want to load that image to load this image

    i do this now with http://fiddler2.com/

    i don't know how to explain
    please see this picture

    i think this can be done with Wininet.dll and WinHTTP.dll

    ANY HELP ?

  2. #2
    Arjay's Avatar
    Arjay is offline Moderator / MS MVP Power Poster
    Join Date
    Aug 2004

    Re: Change http request server response?? proxy?

    Wow, sounds interesting. Can I ask why you want to do this?

  3. #3
    Join Date
    Nov 2013

    Re: Change http request server response?? proxy?

    I want to make adblocker ,for some torrent websites that have flash and images with adult content to replace them with another images,flash banners..

  4. #4
    Join Date
    Apr 2000
    Belgium (Europe)

    Re: Change http request server response?? proxy?

    You can do this at the browser level but it'll be for a specific browser (IE uses Browser Helper Objects for this).
    You can do this at the WinInet level but again, this'll be IE specific since none of the other browsers use WinInet for their communications.
    You can do this at the Packet level which will need a Filter (hook) driver (you'll need the WDK for this).
    You can do this at the socket layer, which will need Socket hooks.
    You can do this at the network driver level, which will need you to make a network driver.
    You can do this at the TDI level with a TDI filter hook. (there is a tool/source on Sysinternals for this iirc).
    You can use a library like winpcap (www.winpcap.org)
    You can use a library like Windivert( (reqrypt.org/divert.html)
    You can do this by making your own proxy (needs browser/internet settings to divert all traffic to the proxy).
    Similarly you can do this by making a firewall hook driver.
    You can intercept API calls from the browsers via something like Detours (or making your own).
    Vista and 2008+ have WFP (windows filtering platform) to do stuff like this
    Simple blocking can be done with windows internet security settings or by flat out blocking (or redirecting) common ad provider sites via the HOSTS file.

    Plenty ways, which is the most suited to your needs will need a bit of investigating.
    Note that some sites won't work if you redirect or block traffic. So it may be necessary to redirect the browser to another file for display, but download the file off the add site anyway to fool them. But even that mechanism has been "found out" by some ad sites.

    Expect this to be quite a bit of work, if you're just looking for a ad blocker, then buying any of the existing ones will save you a lot of time. If you just want to know how to do it and try it for yourself, that is another matter of course

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Windows Mobile Development Center

Click Here to Expand Forum to Full Width

On-Demand Webinars (sponsored)

We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.