Search code examples
javascriptc#razor

How do I determine if my external website user is actually inside our office network?


I've looked at the existing questions/responses in StackOverFlow and there were no working answers so I'm posting this question. Our website is an C# MVC site that uses Javascript for validation etc.

The scenario is this:

We want to display a message in our external website to users (employees) who are actually accessing it from within our office network. The message would remain hidden for users who are outside our network (general public).

Please note that an internal office user is going out to the internet and hitting our external website so they would have a public IP address (not their local network IP) and I can't rely on that public IP address remaining consistent so I can't use the IP as the determining factor.

I would think that this would require a client-side solution but I've looked into JS possible solutions and none have worked.

Can anyone think of a way to determine if the user visiting out external website is an employee or part of the general public?


Solution

  • Thanks everyone for your suggestions. I ended up going a slightly different route which I has seen suggested in another post on another website I believe...I just didn't know if it would work but it does seem to work.

    I put a reference to a .JS file that sits on one of our internal network servers . That JS changes the display value for the message I want do display which is initially hidden. So for the general public the message remains hidden, but for anyone on our network it will unhide the message.