Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Community Forums
 Code Support: ASP (Non-Forum Related)
 IP convert to hostname?
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

Clarence
Starting Member

5 Posts

Posted - 19 June 2001 :  10:09:29  Show Profile
How do write the asp code to convert ip to hostname?

Davio
Development Team Member

Jamaica
12217 Posts

Posted - 19 June 2001 :  13:30:24  Show Profile
Convert? I don't think that's possible to get the hostname of an ip address using asp. You can get the hostname using this code "Request.ServerVariables("REMOTE_HOST")" but not all web servers support reverse dsn lookup. So it will just return the ip address instead.

- David

Edited by - Davio on 19 June 2001 13:31:16
Go to Top of Page

inworg
Junior Member

Italy
153 Posts

Posted - 19 June 2001 :  15:50:58  Show Profile  Visit inworg's Homepage
... but u can use a trick... only if u can use fso and have a folder with read/write rights... If u got it I'll send u the ASP code

Check your IP and hostname here ... sorry... it's in italian



Edited by - inworg on 19 June 2001 15:57:18
Go to Top of Page

redbrad0
Advanced Member

USA
3725 Posts

Posted - 19 June 2001 :  17:22:15  Show Profile  Visit redbrad0's Homepage  Send redbrad0 an AOL message
can you send me that file?

Brad
Go to Top of Page

inworg
Junior Member

Italy
153 Posts

Posted - 19 June 2001 :  18:20:09  Show Profile  Visit inworg's Homepage
Beware: this is NOT a my code. It works, it's free, but isn't my (c). I've only create from original code a function. If I remeber right I've found it at ASPResource.



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 & "> " & server.mappath("\RWFolder\" & strHost & ".txt"), 0, True
'Open the temp Text File and Read out the Data
Set oFS = Server.CreateObject("Scripting.FileSystemObject")
Set oTF = oFS.OpenTextFile(Server.MapPath("\RWFolder\" & strHost & ".txt"))
tempData = Null
Data = Null
i = 0
Do While Not oTF.AtEndOfStream
Data = Trim(oTF.Readline)
If instr(Data,"Name:")>0 Then ' Don't want to display local DNS Info.
tempData = Replace(Data,"Name:","")
End If
i = (i + 1)
Loop
if isnull(tempData)=true or (trim(tempData) = "") then
tempData = "Unknown host"
end if
'Close it
oTF.Close
'Delete It
oFS.DeleteFile Server.MapPath("\RWFolder\" & strHost & ".txt")
Set oFS = Nothing
nsLookup = trim(tempData)
End Function
%>

I hope u find it usefull!



Edited by - inworg on 19 June 2001 18:21:40
Go to Top of Page

redbrad0
Advanced Member

USA
3725 Posts

Posted - 19 June 2001 :  22:13:55  Show Profile  Visit redbrad0's Homepage  Send redbrad0 an AOL message
thanks, ill try it out later

Brad
Go to Top of Page

inworg
Junior Member

Italy
153 Posts

Posted - 21 June 2001 :  15:17:47  Show Profile  Visit inworg's Homepage
What about the code?

Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.8 seconds. Powered By: Snitz Forums 2000 Version 3.4.07