Solved

Client Hostname in vb.net

Posted on 2009-07-15
2
463 Views
Last Modified: 2013-11-26
I am trying to determine the hostname of the client accessing the webpage. If the user is coming from a .edu let them see the button. If not, don't let them see the button.  After searching some groups this is what I have, but I can't get it to work.
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        
 
 
	Public Function IPToHostName(ByVal IPAddress As String) _
          As String
 
        Dim objEntry As IPHostEntry
        Dim sAns As String
        Try
            objEntry = Resolve(IPAddress)
            sAns = objEntry.HostName
        Catch ex As Exception
 
            sAns = ""
        End Try
 
        Return sAns
 
    End Function
 
	Response.Write (sAns)
 
    End Sub
 
End Class

Open in new window

0
Comment
Question by:j1haskins
2 Comments
 
LVL 33

Accepted Solution

by:
raterus earned 500 total points
ID: 24859410
Even if you got this working, I don't think you are going to be happy with it.  In order to do this, you'll have to do a reverse lookup on their IP address.  The ISP owns that ip address, and they are going to have to be nice enough to have entered a nice .edu domain there.  There is no guarantee that is done, and I imagine for the most part it isn't setup properly.
0
 

Author Closing Comment

by:j1haskins
ID: 31603647
Thank you for your assistance.
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question