With additional information it seems that is more or less this:
public class MvcApplication : System.Web.HttpApplication {
public static void RegisterGlobalFilters(GlobalFilterCollection filters) {
filters.Add(new CheckForDownPage());
}
//o resto do global asax
}
public sealed class CheckForDownPage : ActionFilterAttribute {
public override void OnActionExecuting(ActionExecutingContext filterContext) {
var path = System.Web.Hosting.HostingEnvironment.MapPath("~/Down.htm");
if (System.IO.File.Exists(path) && IpAddress != "1.2.3.4") {
filterContext.HttpContext.Response.Clear();
filterContext.HttpContext.Response.Redirect("~/Down.htm");
return;
}
base.OnActionExecuting(filterContext);
}
}
Source.
Doesn’t look like that’s what it even that. If you don’t solve I’ll erase here.
I don’t know if it’s the best option but I found this:
routes.MapRoute("Offline", "{controller}/{action}/{id}",
new {
action = "Offline",
controller = "Home",
id = UrlParameter.Optional
},
new { constraint = new OfflineRouteConstraint() });
Source. There are some options there.
I put in the Github for future reference.
Has another proposed solution that can serve for complex comas scenarios. It may be what you want, but think about if you really need all this, the question doesn’t seem to need.
It depends a lot on what you want to do. If you always want to show this, regardless of anything, you can simply switch routing to always redirect to a action return this view. If you need to do this according to some condition, maybe you should implement a filter, or something like that. No more details your question gets too wide.
– Jéf Bueno
@LINQ edited explaining, that’s the goal
– Leonardo Bonetti
Maniero’s answer then serves.
– Jéf Bueno
@Leonardobonetti The other option I posted also not be seen? If served I can develop more.
– Maniero