Friday, 18 September 2015

Check Internet Connection Is Available Or Not Using Asp.Net C#

Check Internet Connection Is Available

Check Your PC or Laptop Internet Connection Available Or Not Using in Asp.Net C#.

                                DEMO



                               Download
                    

                               C# Coding

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using System.Net;

public partial class _Default : System.Web.UI.Page
{
    protected bool conn()
    {
        try
        {
            WebClient Wcl = new WebClient();

            var  con = Wcl.OpenWrite("http://dotnetdrizzles.blogspot.in");
           {
                return true;
           }
        }
        catch
        {
            return false;
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        bool con = conn();
        if (con == true)
        {
            Response.Write("<script>alert('Internet Connection Available')</script>");
        }
        else
        {
            Response.Write("<script>alert('Internet Connection Not Avail')</script>");
        }
    } 
}










0 comments:

Post a Comment