0

i am making an application that must check before running the internet connection

i am using this code

 try
            {

                req = (HttpWebRequest)WebRequest.Create("http://www.1aeg.net");
                resp = (HttpWebResponse)req.GetResponse();

                if (resp.StatusCode.ToString().Equals("OK"))
                {
                    connected_check = "1";
                }
                else
                {
                    connected_check = "2";
                }
            }
            catch (Exception exc)
            {
                connected_check = "2";
            }

when i logged out from the server the internet connection will be disabled but the internal network in the office is still connected.

when i logged off or i did not enters the user name and password the internet access is not available but the internal network is available through the server.

how i can detect if the internet access is available regardless the internal network connection in the office????

Edited by Nick Evan: Fixed formatting

2
Contributors
1
Reply
2
Views
6 Years
Discussion Span
Last Post by bhagawatshinde
0

Use This For Checking Internet Connection

Ping test = new Ping();
                PingReply result = test.Send("google.com");
                if (result.Status == IPStatus.Success)
                { MessageBox.show("Available")}else
{
MessageBox.show("Not Available")
};
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.