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