How to check in ASP.NET MVC View if site is running on localhost or 127.0.0.1?
You can use the HttpRequest.IsLocal Property
@if (Request.IsLocal) { // do something }
or
<% if (Request.IsLocal) { // do something } %>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With