PDA

View Full Version : ASP: GetHostByAddress


Horus_Kol
07-22-2004, 10:09 AM
i've tried using the ASP GetHostByAddress function to resolve the hostname (or at least the domain) of my visitors.


WHILE NOT RS.EOF
Response.Write("<tr>" & chr(10) & chr(13))
Response.Write("<td class='data'>" & RS("IP_Addr") & "</td>" & chr(10) & chr(13))
Response.Write("<td class='data'>" & RS("Date") & "</td>" & chr(10) & chr(13))

Response.Write("<td class='data'>" & Dns.GetHostByAddress(RS("IP_Addr")) & "</td>" & chr(10) & chr(13))


Response.Write("</tr>" & chr(10) & chr(13))

RS.MoveNext
WEND


but I am getting an error - it is "expecting an object" on the line where I am using the function.

what have i not done?

afterburn
07-22-2004, 10:13 AM
Dns is a .net class....., looks like classic ASP there not ASP.net

Horus_Kol
07-22-2004, 10:19 AM
ah - yes...

is there a way to do it in ASP?

I can do it in PHP, but the rest of the stats scripts are in ASP

afterburn
07-22-2004, 01:07 PM
Only through components.

search for DNS lite C# component. it can be writen in VB with winsocks to make a VB COM object that can do it. Otherwise IP*Works or other AspDns will work.

Horus_Kol
07-23-2004, 04:52 AM
you lost me there... :eek:

afterburn
07-23-2004, 09:29 AM
There is no direct way to do it in ASP.

However there are components that you can purchase or you can build one yourself that can do it.

Horus_Kol
07-23-2004, 09:37 AM
components....

what be they and how do I?

putts
07-23-2004, 10:06 AM
http://www.aspin.com/home/components/internet/dns

This part of Aspin is devoted to just these types of scripts

you should be able to find one of them that will work for you.

Horus_Kol
07-23-2004, 10:32 AM
cheers for all help - and I'm sure that others will find it useful too.

however, I am simply using the user agent to determine bot's...

afterburn
07-23-2004, 10:46 AM
You could just compile a custom .net library to export the object into a COM wrappered .net component.....

In VS.net use the option on the project configs to Register COM object or Generate Type Library.

Only deal is that your required to adhere to the COM specs and base your class on a COM Exposed Interface that will be exposed as the VTable for COM... (Vtables are inherent in C++, they tell the program the offset to the actual function( ie xxx@4 is the symbol that points to xxx(sub note: @4 is the byte alignment))) wow a lot of information htere...

putts
07-23-2004, 12:41 PM
Originally posted by afterburn
You could just compile a custom .net library to export the object into a COM wrappered .net component.....

In VS.net use the option on the project configs to Register COM object or Generate Type Library.

Only deal is that your required to adhere to the COM specs and base your class on a COM Exposed Interface that will be exposed as the VTable for COM... (Vtables are inherent in C++, they tell the program the offset to the actual function( ie xxx@4 is the symbol that points to xxx(sub note: @4 is the byte alignment))) wow a lot of information htere...

Okay, Mr. Over-the-top ;) :P

afterburn
07-23-2004, 12:45 PM
Originally posted by putts
Okay, Mr. Over-the-top ;) :P

Just wanted to make sure he understood ... and not be misleading with the COM/.net and the differences... he could just expose the stuff as COM objects relying on .net to do the work...


Its better to explain how it all works underneath than just explain a solution IMHO, as it will allow him to build better solutions ...

Horus_Kol
07-23-2004, 01:38 PM
well, my head is about 6 feet, but I think you were aiming for the statue of liberty when you threw all that at me...

afterburn
07-23-2004, 03:55 PM
Well you sound to be more apt with PHP than ASP. Wanted to explain that you can make .net components that can be used in ASP.

A bit of explaination of how COM works gives you a good idea on how to build COM objects yourself instead of always creating ASP pages you can create COM+ apps or COM objects, they are compiled so you get 10 times the speed out of them.

COM is awesome when building large scale websites.