Is it possible to make part of a site on IIS only viewable from localhost?

前端 未结 10 783
后悔当初
后悔当初 2020-12-15 05:19

We\'ve got a webserver running IIS. We\'d like to run maybe a shared blog or something to keep track of information. Because of security issues, we\'d like for that part to

10条回答
  •  囚心锁ツ
    2020-12-15 05:27

    You could simply add this .NET to the top of the page.

    string MyWebServerName = currentContext.Request.ServerVariables["SERVER_NAME"];
    
    if ( MyWebServerName == "127.0.0.1" || MyWebServerName == "localhost" )
    {
      // the user is local 
    }
    else
    {
      // the user is NOT local
    }
    

提交回复
热议问题