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.Url.DnsSafeHost.Contains("localhost") || Request.UserHostName.Contains("127.0.0.1"))
{
} %>
for global.asax
if (System.Diagnostics.Debugger.IsAttached){themeName = ConfigurationManager.AppSettings["ThemeName"];}
@if (Request.IsLocal) { // do something }
or
<% if (Request.IsLocal) { // do something } %>