<%@ Page Language="c#" Debug="true" %>
<%@ Import Namespace="System" %>
<%@ Import Namespace="System.Net" %>
<script language="c#" runat="server">
void BtnCheck_Click(Object sender,EventArgs e) {
try
{
IPHostEntry GetIPHost = Dns.GetHostByName(Request.QueryString["domain"] + ".org");
LblValue.Text += "<br>" + Request.QueryString["domain"] + ".org#";
foreach(IPAddress ip in GetIPHost.AddressList)
{
long HostIpaddress = ip.Address;
LblValue.Text += ip.ToString() + "#";
}
}
catch(Exception ex){
LblValue.Text += "<br>" + Request.QueryString["domain"] + ".org#";
LblValue.Text += "" + ex.Message + "#";
}
}
</script>
<html>
<title>DNS LOOKUP</title>
<head>
</head>
<body OnLoad="BtnCheck_Click" value="Send" runat="server">
<asp:Label id="LblValue" runat="server" />
</body>
</html>
When I try to make a dns lookup, it can take more than 3-4 seconds to get the information. I want to limit its loading time to 1000 milliseconds. If it passes to 1001 milliseconds or more, I want to exit the try
block. How can I insert a timer to this code?