DNS Lookup program with ASP

Source: Internet
Author: User
Tags servervariables nslookup
The article translates from ASP101
Operating environment, NT (SERVER, WORKSTATION), W2K
Need to install WSH2.0 or later on the server
If your system does not currently have WSH2.0 installed, you can download it from the following address
Http://www.microsoft.com/msdownload/vbscript/scripting.asp
It contains WSH2.0.
Below is the source code
<%@ language= "VBScript"%>
<% Option Explicit%>
<%
If Request.Form ("frmhost") = "" Then
' Set the initial value
StrIP = Request.ServerVariables ("REMOTE_ADDR")
Else
StrIP = Request.Form ("Frmhost")
End If
%>
<title>dns Lookup [v 1.0]</title>
<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
' 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
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.