Results 1 to 3 of 3
  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Sep 2011

    Check if website is accessed from outside the campus or within the campus


    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!

  2. #2
    Superbly Moderated NeedSomeAnswers's Avatar
    Join Date
    Jun 2002
    Manchester uk

    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

  3. #3
    Frenzied Member Lightning's Avatar
    Join Date
    Oct 2002

    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
    VB6 & C# (WCF LINQ) mostly

    If you need help with a WPF/WCF question post in the NEW WPF & WCF forum and we will try help the best we can

    My site

    My blog, couding troubles and solutions

    Free online tools

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


Click Here to Expand Forum to Full Width