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!
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
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