Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Client Hostname in vb.net

Posted on 2009-07-15
2
Medium Priority
?
473 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 1500 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

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
Loops Section Overview
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …

824 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