locked
IsOnNetwork .net RRS feed

  • Question

  • User-515183 posted

    This is got me the code moved to test and production are the same one thing not happening in production is seeing the user is on the network. 

    (HttpContext.Current.User as blah.Web.Infastructure.CustomPrincipal) != null &&
                                (HttpContext.Current.User as blah.Web.Infastructure.CustomPrincipal).IsOnNetwork)

    the Production server is outside of the firewall but this always worked before. 

    The test server detects user is on network but on prod it does not.  Please advise????

    Monday, August 22, 2016 7:21 PM

Answers

  • User36583972 posted

    Hi sbuggle,

    The test server detects user is on network

    You can get the IP host of the remote client and check the IP (user) is on network.

    if (Request.UserHostAddress.StartsWith("192.168"))
    {
        //localuser
    }
    else
    {
        //
    }

    Best Regards,

    Yohann Lu

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, August 24, 2016 6:56 AM

All replies

  • User753101303 posted

    Hi,

    And what does IsOnNetwork? Could it be that it uses the IP address of a reverse proxy rather than a actual user IP external web address? What is even the purpose of knowing this?

    Monday, August 22, 2016 7:30 PM
  • User36583972 posted

    Hi sbuggle,

    The test server detects user is on network

    You can get the IP host of the remote client and check the IP (user) is on network.

    if (Request.UserHostAddress.StartsWith("192.168"))
    {
        //localuser
    }
    else
    {
        //
    }

    Best Regards,

    Yohann Lu

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, August 24, 2016 6:56 AM