"Kenneth Fuglsang" <kenneth-fuglsang@pc.dk> skrev i en meddelelse
news:3b9a68d7$0$343$edfadb0f@dspool01.news.tele.dk...
> Hey
>
> Kan man via ASP lave noget som skriver Brugerens Host altså noget ligesom
> ip6xx.arcnxx4.adsl.tele.dk ?
>
Hvis du har adgang til Wscript.Shell, så kan du bruge følgende, ellers
findes der andre komponenter der kan det samme:
<form>
<input type=text name=strHost value="<%=request.querystring("strHost")%>">
<input type=submit>
</form>
<%
if request.querystring("strHost") <> "" then
response.write NSlookup(request.querystring("strHost"))
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 = ""
Data = ""
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
start = InStr(tempData,":")+5
slut = InStr(mid(tempData,start+2),"<BR>")
nsLookup = mid(tempData,start,slut+1)
End Function
%>
Mvh. Christoffer Thygesen
e-mail: cht@cht.dk
homepage:
http://cht.dk