Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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

like image 663
Alexey Zakharov Avatar asked Jul 09 '10 03:07

Alexey Zakharov


2 Answers

You can use the HttpRequest.IsLocal Property

like image 171
Aristos Avatar answered Sep 20 '22 20:09

Aristos


@if (Request.IsLocal) { // do something } 

or

<% if (Request.IsLocal) { // do something } %> 
like image 42
LaundroMatt Avatar answered Sep 19 '22 20:09

LaundroMatt