is there a way to tell where our viewers are coming from?
i know we can trap IP's and stuff but how do i determine if they are coming from say .edu or .com or .net?
if that doesn't make sense, please tell me and i'll try and re-word it.
thank you
Printable View
is there a way to tell where our viewers are coming from?
i know we can trap IP's and stuff but how do i determine if they are coming from say .edu or .com or .net?
if that doesn't make sense, please tell me and i'll try and re-word it.
thank you
Code:<html>
<head>
<title>Resolve IP</title>
</head>
<body>
<p>Hello freak of nature, connected from <%
set bh = Server.CreateObject("cyScape.browserObj")
hostname = bh.ResolveIP
if hostname <> "" then
response.write hostname
else
response.write "Unknown Dumbass"
end if
%> </p>
<p>%></p>
</body>
</html>
that's great.
is there a way to do it w/ out browserhawk?
:D
Thanks!
OK... I'm going to sound like an idiot here.Quote:
Originally posted by pnj
that's great.
is there a way to do it w/ out browserhawk?
:D
Thanks!
Browserhawk???
Did I miss something? :(
if me.retarted=true then
kick me in the shins
end if
msgbox "My shins hurt!"
well, were did you get the object cyScape?
i have used a component called browserhawk before and it is made by a company called cyScape.
when i tried to run your code i got a Server.CreateObject Failed
message.
(rubbing my shins....in pain...)
;)
WHOOPS!! yup my fault actually. You can kick me :D
Yes... As such, I don't think it's possible to simply get the domain name by looking at an IP address.
You'll have to get a component or tool for this.
see here:
http://www.aspobjects.com/ASP_Components/network/dns/
I suppose one could write a component that calls nslookup.
you could pass the component the IP and it would call nslookup, get the domain and pass it back.
i have no idea how to call nslookup from a component though.
but in theory it sounds easy eh?
hi,
this is a terrible suggestion..
whenever I need to do something quick (and dirty) - rather than dig out the relvent object/api, i often resort to just shelling a prompt (call shell.....).
As nslookup takes a set of commands and an exit to end, I guess that when you want to do a lookup (you could) use the FSO to create parms.txt containing 2 lines (ip address on the first, EXIT on the second) - shell "type pass.txt | nslookup > info.dat" - then again use the FSO to read info.dat - then stringslice out the "name: remotename" line..... - all on the server
very dirty - very bad - use it often for ftp/sending message and adding user accounts to the localadmin group...... :)
jpritchard
that sounds cool to me. what makes it so dirty and bad?
would using the API be more effeciant?
hi
yeah you are right the api is by far the better way to go..
shelling command is just duff.... but very useful particularly when you have a command based 3rd party product which has some functionality you would like to incoporate into a vb app. If they provide NO object/api then this type of thing would work but dunno what the server impact would be, (threading etc etc......)
<%
option explicit
Dim strIP, objWsh, objRtc, objfso, objFile, strCommand, strContent, strupdpath
'----the one you want
strIP = "127.0.0.1"
'---some path on the server where iuser etc can update!!
strupdpath = "c:\inetpub\wwwroot\upddir\"
Set objfso = Server.CreateObject("Scripting.FileSystemObject")
Set objFile = objfso.CreateTextFile(strupdpath & "nslookup.txt", True)
objFile.WriteLine(strip)
objFile.WriteLine("exit")
objFile.Close
Set objFile = nothing
strCommand = "cmd /c type " & strupdpath & "nslookup.txt | nslookup > " & strupdpath & "nslookup.dat"
Set objWsh = Server.CreateObject("WScript.Shell")
objRtc = objWsh.Run (strCommand , 0, True)
Set objWsh = Nothing
Set objFile = objfso.OpenTextFile( strupdpath & "nslookup.dat", 1)
strContent = objFile.ReadAll
Set objFile = nothing
Set objfso = nothing
'---ling out the whole response..
Response.Write strContent
Response.Write "<br>done!"
%>
just found this!!!!
http://www.mvps.org/vbnet/index.html...namefromip.htm
nice!
Thanks for both the code and the link!