Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Determine if ASP.NET application is running locally

I want to know if there is a recommended way of determining if an asp application is running locally. At the moment I use the Request object and do a string search for localhost or 127.0.0.1 on the server variable but this has several limitations. The biggest one being that the Request object is not always available when I need it.

like image 428
Sean Avatar asked Mar 28 '09 00:03

Sean


People also ask

How to check ASP.NET is installed or not?

Run the command import-module servermanager. ASP.NET 4.5: Run the command get-windowsfeature Net-Framework-45-Core. The output indicates the ASP.NET 4.5 install state ("Installed" or "Available").

How would you diagnose the poor performance from a .NET application?

The best way to monitor the performance of your ASP.NET application is with an application performance management (APM) solution. Retrace tracks the performance of your application down to the code level and provides detailed reporting of ASP.NET application performance.


2 Answers

See HttpRequest.IsLocal

bool isLocal = HttpContext.Current.Request.IsLocal; 
like image 168
Rex M Avatar answered Sep 28 '22 02:09

Rex M


You can check the Request.IsLocal property

like image 25
Adam Avatar answered Sep 28 '22 02:09

Adam