Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6134575
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T17:22:21+00:00 2026-05-23T17:22:21+00:00

To test if our computer is connected to a firewall we check if the

  • 0

To test if our computer is connected to a firewall we check if the loginwebpage for this firewall opens. If it times out, the error handling will say it’s connected, if it opens (or throws a certificate error as it does in our case) we know we are not connected.

The big problem with this process is that whenever we are already connected, the application hangs until the webpage times out..

Any input is more than welcome, here’s the code I use:

    public static bool FirewallConnectivityStatus(string url)
    {
        try
        {
            HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
            request.Proxy = null;
            HttpWebResponse response = (HttpWebResponse)request.GetResponse();

            if (HttpStatusCode.OK == response.StatusCode)
            {
                response.Close();
                return false;
            }
            else
            {
                return true;
            }


        }
        catch (WebException Ex)
        {
            if (Ex.Status == WebExceptionStatus.TrustFailure)
            {
                return false;
            }
            else
            {
                return true;
            }
        }

    }

Update
In the meantime I have found a socket connection that will allow me far better to create this connection via the IP in stead of the url: C# – Socket to log on to Firewall

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T17:22:22+00:00Added an answer on May 23, 2026 at 5:22 pm

    Maybe using a BackgroundWorker could work:

    http://msdn.microsoft.com/en-us/library/system.componentmodel.backgroundworker.aspx

    They have quite a decent example on that page. I’ve never thought about trying to test this before. I cannot think of a simple way to test it. It looks like its been asked before as well:

    C# API to test if a network Adapter is firewalled

    At least the background worker could let your program continue while waiting for the timeout. It just depends if you can let the app continue at the point you are testing it without an answer.

    How about reducing the timeout period? http://msdn.microsoft.com/en-us/library/system.net.httpwebrequest.timeout.aspx

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am working on an update to one of our sites. This version will
We are currently using unit tests to test our project. We have the majority
I have Selenium running under Cruise Control to test our site once a day.
I'm using IntelliJ-Idea to write Java daemons. We use JUnit to unit test our
Our Test DB is suddenly missing rows. We want them back. Is there a
Our test department has a series of web tests created using Visual Studio 2005
For our test fixtures we use NHibernate to generate a database schema. We have
We are migrating our test report data (unit, regression, integration, etc..) from an XML
Our vendor needs some access to our test server, and thus we send them
I just added xUnit to our test project (for the Asserts, we're still using

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.