Solved

Check if connection to website is from external source

Posted on 2014-01-02
3
257 Views
Last Modified: 2014-01-02
I want to check if a user is connecting to a site from our intranet or outside of it and redirect them if they are coming from outside.
0
Comment
Question by:UnderSeven
  • 2
3 Comments
 
LVL 28

Accepted Solution

by:
sammySeltzer earned 500 total points
ID: 39751525
This is how I owuld approach it.

'Create a variable to hold your IP address.  

Dim ipAddress As String = ""


'Retrieve the user's ip address from Page_Load():

ipAddress = Request.ServerVariables("REMOTE_ADDR")

'Then compare the retrieved IP address to the subnet for your network which is usually "192.168.0"  or whatever it is. You can find out from your network admins.

If ipAddress.Contains("192.168.0") Then
	Response.Write("an internal user ")
Else
	Response.Redirect("someplace else")
End If

Open in new window

0
 

Author Closing Comment

by:UnderSeven
ID: 39751865
Yep worked just fine.
0
 
LVL 28

Expert Comment

by:sammySeltzer
ID: 39751890
Congrats and thanks for the points.
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

IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

808 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