I have not tried so not sure about App_Offline.htm way to handle it. Details here:
App_Offline.htm [
^]
Following is one of the ways suggested and implemented by quite a few:
Implement “Down for maintenance” page[
^]. It says:
You can use a catch-all route with a RouteConstraint with the IP check.
Make sure you put the offline route first.
routes.MapRoute("Offline", "{controller}/{action}/{id}",
new
{
action = "Offline",
controller = "Home",
id = UrlParameter.Optional
},
new { constraint = new OfflineRouteConstraint() });
and the constraint code:
public class OfflineRouteConstraint : IRouteConstraint
{
public bool Match(HttpContextBase httpContext, Route route, string parameterName, RouteValueDictionary values, RouteDirection routeDirection)
{
}
}
One other way suggested:
By Using: ActionFilterAttribute[
^]