เป็น code asp.net ครับ เจอแต่ของ php แต่อยากได้ของ asp.net ครับ
Tag : .NET, VB.NET, VS 2008 (.NET 3.x)
Date :
2011-02-09 21:19:05
By :
lek
View :
1201
Reply :
3
No. 1
Guest
Code (VB.NET)
<% @Page Language="VB" %>
<% @Assembly Name="System.Net" %>
<% @Import Namespace="System.Net.Sockets" %>
<% @Import Namespace="System.Text" %>
<% @Import Namespace="System.IO" %>
<%
Dim tcpc As New TCPClient()
If 0 = tcpc.Connect("whois.networksolutions.com", 43) Then
Dim strDomain As [String] = "microsoft.com" + ControlChars.Cr + ControlChars.Lf
Dim arrDomain As [Byte]() = Encoding.ASCII.GetBytes(strDomain.ToCharArray())
Dim s As Stream = tcpc.GetStream()
s.Write(arrDomain, 0, strDomain.Length)
Dim sr As New StreamReader(tcpc.GetStream(), Encoding.ASCII)
While - 1 <> sr.Peek()
Response.Write((sr.ReadLine() + "<br>"))
End While
tcpc.Close()
Else
Response.Write("Could not connect to WHOIS server!")
End If
%>
Date :
2011-02-10 06:23:14
By :
-
No. 2
Guest
Code (C#)
<% @Page Language="C#" %>
<% @Assembly Name="System.Net" %>
<% @Import Namespace="System.Net.Sockets" %>
<% @Import Namespace="System.Text" %>
<% @Import Namespace="System.IO" %>
TCPClient tcpc = new TCPClient();
if (0 == tcpc.Connect("whois.networksolutions.com", 43)) {
String strDomain = "microsoft.com" + ControlChars.Cr + ControlChars.Lf;
Byte[] arrDomain = Encoding.ASCII.GetBytes(strDomain.ToCharArray());
Stream s = tcpc.GetStream();
s.Write(arrDomain, 0, strDomain.Length);
StreamReader sr = new StreamReader(tcpc.GetStream(), Encoding.ASCII);
while (-1 != sr.Peek()) {
Response.Write((sr.ReadLine() + "<br>"));
}
tcpc.Close();
} else {
Response.Write("Could not connect to WHOIS server!");
}
Date :
2011-02-10 06:27:28
By :
-
No. 3
Guest
Code (VB.NET)
<% @Page Language="VB" %>
<% @Import Namespace="System.Net.Sockets" %>
<% @Import Namespace="System.Text" %>
<% @Import Namespace="System.IO" %>
<%
Dim tcpc As New TcpClient()
Try
tcpc.Connect("whois.networksolutions.com", 43)
Catch ex As SocketException
Response.Write(ex.ToString())
Response.[End]()
End Try
Dim strDomain As [String] = "domains.com" & vbCr & vbLf
Dim arrDomain As [Byte]() = Encoding.ASCII.GetBytes(strDomain.ToCharArray())
Dim s As Stream = tcpc.GetStream()
s.Write(arrDomain, 0, strDomain.Length)
Dim sr As New StreamReader(tcpc.GetStream(), Encoding.ASCII)
Dim strLine As String = Nothing
While (InlineAssignHelper(strLine, sr.ReadLine())) IsNot Nothing
Response.Write(strLine & "<br>")
End While
tcpc.Close()
%>