Solved

Client Hostname in vb.net

Posted on 2009-07-15
2
464 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Suggested Solutions

More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
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.
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

749 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