Results 1 to 2 of 2

Thread: Detect Web Request Block

  1. #1

    Thread Starter
    Fanatic Member clarkgriswald's Avatar
    Join Date
    Feb 2000

    Detect Web Request Block

    I have an app that makes request to our API endpoints. Before making the requests, I check to make sure that the user can reach our site by using something like this:

    Using webClient As New Net.WebClient()
         Using stream As System.IO.Stream = webClient.OpenRead(url)
              Return True
         End Using
    End Using
    If this returns false, we display a communication error message. I would like to extend this to determine if this is failing due to a firewall, virus scanner, etc. blocking the request. Any help here?

  2. #2
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Bristol, UK

    Re: Detect Web Request Block

    How blocking is done varies significantly, even within each "category" of things that can block it.

    Sometimes there will be an exception you can Catch, sometimes there will be an HTTP return code (which might be raised as an exception), sometimes there will be something you can read (which sometimes includes a special web page that is returned, rather than the requested one [examples]), etc.

    I doubt that there will be a simple way to check, as there are so many different things you need to check for... and they will only check the things that you are aware of (eg: if you set up something to ask a particular virus scanner if it blocks the URL, that wont help with another virus scanner, or later versions of the same virus scanner that use a different API).

    In situations like this I think it is best to try to detect if you can, but if for any reason it fails then show a message which lists the different things that you suspect could cause the problem.
    Last edited by si_the_geek; Jan 25th, 2018 at 01:49 PM. Reason: added link

Posting Permissions

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


Click Here to Expand Forum to Full Width