Solved

Client Hostname in vb.net

Posted on 2009-07-15
2
467 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

622 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