0
。 我用c#语言开发了一个使用asp.net的网页,在这个网页中,我有一个用于获取域和按钮的url的文本框。当用户在文本框中输入域名并按下按钮时,该域的详细信息将显示在另一个窗口中。我从stackoverflow用户获得帮助,我得到的代码工作正常,但是当我输入域名特别是“.in”时,doamins没有提供详细信息。只是域可用消息显示实际上该域名已注册例如我尝试“axisbank.co.in”在我的网页它显示的域是可用的,但实际上它已被采取。我送我的代码,请帮我(特别。在域名)域名检查器(Whois)?
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 !! ";
}
}
帮我谢谢
喜Priyank Bolia。你说这个.in,.co.in在这段代码中不行,我是对的吗? – 2009-11-18 09:53:21
所以如果你有一个想法是什么是替代方案,请给予答复 – 2009-11-18 09:54:05
检查whois.registry.in是否适用于whois协议,这是唯一可以看到的替代方案 – 2009-11-18 09:58:13