How to limit page access only to localhost?

后端 未结 3 2123
伪装坚强ぢ
伪装坚强ぢ 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:24

         if (!HttpContext.Current.Request.IsLocal)
         { 
           Response.Status = "403 Forbidden";
           Response.End();
         }
    

提交回复
热议问题