国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > ASP > 正文

用ASP做的DNS LOOKUP程序

2020-07-27 13:13:02
字體:
來源:轉載
供稿:網友
運行環境,NT(SERVER、WORKSTATION)、W2K
服務器上需要安裝WSH2.0或者更高版本
如果您的系統目前沒有安裝WSH2.0,您可以從以下這個地址去下載它
http://www.microsoft.com/msdownload/vbscript/scripting.asp
里面包含了WSH2.0
下面是源代碼
<%@ Language="VBScript" %>
<% Option Explicit %>
<%
If Request.Form("frmHost") = "" Then
    '設置初始值 
    strIP = Request.ServerVariables("REMOTE_ADDR")
Else
    strIP = Request.Form("frmHost") 
End If
%>
<html>
<head>
    <title>DNS Lookup [v 1.0]</title>
</head>
<body bgcolor="#FFFFFF">
<form Method="POST" Name="frmRDNS">
    <label for="frmHost"><u>Host:</u></label>
    <input type="text" name="frmHost" ID="frmHost"
        value="<%= strIP  %>">
    <input type="button" name="btnSubmit" ID="btnSubmit"
        value="Lookup" onClick="document.frmRDNS.submit()">
</form>
<font face="arial" size="2" color="#003366">
<%
rMethod = uCase(Request.ServerVariables("REQUEST_METHOD"))
If rMethod = "POST" Then
    ' Lookup Host
    strReturn = nsLookup(strIP)
    If strReturn <> "" Then
        Response.Write strReturn
    Else
        ' A Lame Host is any Valid Host that DNS Cannot Resolve
        ' See InterNic for Details
        Response.Write "<b>Lame Host - Could Not Resolve DNS For " _
            & strIP & "</b><br>"
    End If
End If
Function NSlookup(strHost)
    'Create Shell Object
    Set oShell = Server.CreateObject("Wscript.Shell")
    'Run NSLookup via Command Prompt
    'Dump Results into a temp text file
    oShell.Run "%ComSpec% /c nslookup " & strHost _
        & "> C:/" & strHost & ".txt", 0, True
    'Open the temp Text File and Read out the Data
    Set oFS = Server.CreateObject("Scripting.FileSystemObject")
    Set oTF = oFS.OpenTextFile("C:/" & strHost & ".txt")
    tempData = Null
    Data = Null
    i = 0
    Do While Not oTF.AtEndOfStream
        Data = Trim(oTF.Readline)
            If i > 2 Then ' Don't want to display local DNS Info.
                tempData = tempData & Data & "<BR>"
            End If
        i = (i + 1)
    Loop
    'Close it
    oTF.Close
    'Delete It
    oFS.DeleteFile "C:/" & strHost & ".txt"
    Set oFS = Nothing
    nsLookup = tempData
End Function
%>
</font>
</body>
</html>
代碼很簡單,我不多說了,如果您對WSH有什么疑問的話,請去下載WSH的電子文檔中文版本的,CHINAASP下載區就有的吧
希望能對你有所幫助。
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 莱西市| 赤峰市| 漯河市| 舞钢市| 漯河市| 遵义县| 米林县| 安阳县| 池州市| 望城县| 武城县| 海淀区| 天等县| 新乡县| 井冈山市| 买车| 梧州市| 洛扎县| 五华县| 孝义市| 冕宁县| 永康市| 永昌县| 土默特左旗| 冀州市| 治多县| 台江县| 连南| 邯郸市| 武强县| 宁陕县| 龙山县| 叙永县| 贵港市| 上饶市| 凉山| 三明市| 濉溪县| 凭祥市| 特克斯县| 临邑县|