Solved

Check if connection to website is from external source

Posted on 2014-01-02
3
262 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
[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
3 Comments
 
LVL 29

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 29

Expert Comment

by:sammySeltzer
ID: 39751890
Congrats and thanks for the points.
0

Featured Post

Stressed Out?

Watch some penguins on the livecam!

Question has a verified solution.

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

Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

717 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