对所有人。 我使用带有c#语言的asp.net开发一个网页,在这个网页上我有一个文本框,用于获取域名和按钮的URL。当用户在文本框中输入域名并按下按钮时,域的详细信息将显示在另一个窗口中。我从stackoverflow用户那里得到帮助,我得到的代码工作正常,但是当我输入域名特别是“。”时,doamins没有提供详细信息。简单的域可用消息实际上显示域已注册,例如我在我的页面中尝试“axisbank.co.in”它显示域可用但实际上已经采取了。我发送我的代码请帮助我(特别是.in域名)
protected void Button1_Click(object sender, EventArgs e)
{
lblDomainName.Text = Session["WhoIs"].ToString();
string firstLevelbufData = null;
// Stores the bufData extracted from the webclient
try
{
// similarly we can select any server address for bufData mining
string strURL = "http://www.directnic.com/whois/index.php?query=" + txtDomain.Text;
WebClient web = new WebClient();
// byte array to store the extracted bufData by webclient
byte[] bufData = null;
bufData = web.DownloadData(strURL);
// got the bufData now convert it into string form
firstLevelbufData = Encoding.Default.GetString(bufData);
}
catch (System.Net.WebException ex)
{
// this exception will be fired when the host name is not resolved or any other connection problem
//txtResult.Text = ex.Message.ToString();//sasi
lblresult.Text = ex.Message.ToString();
return;
}
try
{
// first and last are the regular expression string for extraction bufData witnin two tags
// you can change according to your requirement
string first = null;
string last = null;
// chr(34) is used for (") symbol
first = "<p class=\"text12\">";
last = "</p>";
Regex RE = new Regex(first + "(?<MYDATA>.*?(?=" + last + "))", RegexOptions.IgnoreCase | RegexOptions.Singleline);
// try to extract the bufData within the first and last tag
Match m = RE.Match(firstLevelbufData);
// got the result
//txtResult.Text = m.Groups["MYDATA"].Value + "<br>";//sasi
lblresult.Text = m.Groups["MYDATA"].Value + "<br>";
// check if no information abour that domain is available
//if (txtResult.Text.Length < 10) txtResult.Text = "Domain "+ txtDomain .Text +" is Available";//sasi
if (lblresult.Text.Length < 10)
lblresult.Text = "Domain " + txtDomain.Text + " is Available";
}
catch (System.Net.WebException ex)
{
lblresult.Text = " Sorry the information is currently not available !! ";
}
}
帮我谢谢
答案 0 :(得分:1)
http://www.directnic.com 没有关于.co.in域名的信息。 大多数whois网站不允许您在填写CAPTCHA之前获取结果。
http://registry.in/是官方注册表,请尝试在whois.registry.in上使用whois协议