How to check in ASP.NET MVC View if site is running on localhost or 127.0.0.1

前端 未结 4 1970
离开以前
离开以前 2020-12-18 17:48

How to check in ASP.NET MVC View if site is running on localhost or 127.0.0.1?

4条回答
  •  Happy的楠姐
    2020-12-18 18:22

           <% if (Request.Url.DnsSafeHost.Contains("localhost") || Request.UserHostName.Contains("127.0.0.1"))
           {
    
           } %>
    

提交回复
热议问题