-
Nov 11th, 2014, 12:27 AM
#1
Thread Starter
Addicted Member
Check if website is accessed from outside the campus or within the campus
Hi.
I am developing a system here in the school that automatically sends employees email notification (using SQL Server 2008 jobs) if they are late. In this case, the email contains a link to a page where they can file their time in instead of tapping in the machine.
The page is built using ASP.Net and C# in codebehind.
The page must only be accessible in the campus and this is stored in a server. (server33) is the name of the server with an IP Address of 173.***.**.***
Now, if the employee receives an email and tried to access it outside the campus. it should display
"The page is not accessible off-campus".
Is there a way to detect if site was accessed outside the school using c# or any medium>?
I really need your help and any answer will be greatly appreciated!
Thanks and have a wonderful day!
-
Nov 12th, 2014, 04:36 AM
#2
Re: Check if website is accessed from outside the campus or within the campus
You would probably need to check if the accessing computer has an IP address in your local networks IP range.
For that you will need to know what IP range you use. Look at your own IP address -
open a command prompt and type - IPConfig + hit Enter
Note done the first 3 parts - '172.198.10' and check to see if the accessing IP address are in that range. (nb - You may have more than 1 IP range in your college)
The following link may help - GetIPAddressofaMachine & CheckIfInIPRange
Please Mark your Thread "Resolved", if the query is solved & Rate those who have helped you
-
Nov 13th, 2014, 02:22 PM
#3
Re: Check if website is accessed from outside the campus or within the campus
You have several options:
-Use a firewall
-In the IIS manager use the "IP address and domain restrictions" option, this allows you to allow/deny ip ranges.
-In the website-code you could get the IP address from the client using Request.UserHostAddress
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|