Solved

Check if connection to website is from external source

Posted on 2014-01-02
3
251 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

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
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 video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

708 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now