tags:

views:

28

answers:

2

Hi guys,

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

Best regards, Alexey Zakharov.

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

       } %>
willbt
+2  A: 

You can use the IsLocal function

Aristos
That is what i'm looking for! Thanks.
Alexey Zakharov