Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Check if connection to website is from external source

Posted on 2014-01-02
3
Medium Priority
?
267 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 2000 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

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

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…
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…
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…

609 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