How to limit page access only to localhost?

后端 未结 3 2135
伪装坚强ぢ
伪装坚强ぢ 2020-12-03 12:13

Is there a way in asp.net to limit the access to a web page only from localhost?

3条回答
  •  北荒
    北荒 (楼主)
    2020-12-03 12:26

    If you want to do this for a "web page" then I'd use IsLocal, but if you want a subdirectory solution I'd use Url Rewrite 2. http://www.microsoft.com/web/gallery/install.aspx?appid=urlrewrite2. If you don't have this installed already, go and get it as it's very useful. I believe it will be standard on IIS8.

    Then add this to your web.config under

    
     
        
        
          
          
          
            
            
            
            
          
          
          
          
        
      
    
    

提交回复
热议问题