Welcome to WebmasterWorld Guest from 34.238.189.171

Forum Moderators: ocean10000

Message Too Old, No Replies

Need to perform a forward / reverse DNS lookup

     
9:04 am on Dec 12, 2007 (gmt 0)

Preferred Member

10+ Year Member

joined:Oct 19, 2004
posts: 355
votes: 1


Hi,

does any one know or can they point me in the right direction on how i can perform this on a iis web server?

I'll even buy a tool if its out there ;)

Vimes.

11:27 am on Dec 12, 2007 (gmt 0)

Preferred Member

10+ Year Member

joined:Oct 19, 2004
posts:355
votes: 1


Just to clarify what issues I'm having:

All my pages are static, i would like to perform a lookup and allow access depending on the results returned.

Can any one help me with this problem.

Vimes.

2:50 am on Dec 13, 2007 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Feb 13, 2005
posts:1078
votes: 0


Hey Vimes, you can use the code below to get the reverse DNS entry of the remote IP:

Dim strReverseDNS As String = ""
Try
strReverseDNS = System.Net.Dns.GetHostByAddress(Request.ServerVariables("REMOTE_ADDR")).HostName
Catch exc As Exception
strReverseDNS = Request.ServerVariables("REMOTE_ADDR")
Finally
End Try

It is VERY important to keep this in the Try/Catch block as there is a coding error in the .Net Framework which will error out if the IP address is xx.xx.x x x.x x x

Because you are using static html pages, you'll need to place this code in the global.asax file which needs to reside in your root application directory. If you don't have one, you will need to add it in.

Here's a good article on creating one and the different events that can get fired from inside of it:
[articles.techrepublic.com.com...]

You'll want to place your reverse dns code in the "Application_BeginRequest" sub.

Chip-

6:56 am on Dec 13, 2007 (gmt 0)

Preferred Member

10+ Year Member

joined:Oct 19, 2004
posts:355
votes: 1


Thanks Chip,

I'm looking at it now and I'll report back (hehe) when i have questions ;)

Vimes.

10:12 am on Dec 14, 2007 (gmt 0)

Preferred Member

10+ Year Member

joined:Oct 19, 2004
posts:355
votes: 1


Hi Chip,

setting up the global.asax file and running my static pages through it unfortunately doesn't want to work after a period of time the web server grinds to a holt and we have to restart, we do have fairly high traffic website would this be the reason or can you think of something that i might have messed up.

Vimes.

[edited by: Vimes at 10:13 am (utc) on Dec. 14, 2007]

6:14 pm on Dec 18, 2007 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Feb 13, 2005
posts:1078
votes: 0


can you copy and paste your global.asax file here?
7:23 am on Dec 20, 2007 (gmt 0)

Preferred Member

10+ Year Member

joined:Oct 19, 2004
posts:355
votes: 1


Hi Chip,

Thanks for your reply and willingness to help,

we've found an alternative method where we are using isapi to send to a asp script that opens the gate if they pass.

Once again thanks very much for your comments and help.

Vimes.

 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members