Click here to Skip to main content
12,954,464 members (49,769 online)
Rate this:
 
Please Sign up or sign in to vote.
See more:
Hi,

Can anyone tell me how re-direct to web site down Maintenace page in MVC3, so whenever users log in they should be re-directed to Maintenance down page, when site is down

Note :- Some users should be able to access the application for testing purpose, remaining all user should be denied access and redirected to Down page.
Authentication Used : Windows

Thanks
Vikram
Posted 6-Nov-12 9:25am
Updated 6-Nov-12 12:07pm
v2

1 solution

Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

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)
    {
        // return IpAddress != "1.2.3.4";
    }
}


One other way suggested: By Using: ActionFilterAttribute[^]
  Permalink  
Comments
Vikramdcecse 6-Nov-12 18:08pm
   
hey thanks sandeep, i tried the app.htm it worked but one more condition
Note :- Some users should be able to access the application for testing purpose, remaining all user should be denied access and redirected to Down page.
Authentication Used : Windows
Sandeep Mewara 26-Nov-12 22:25pm
   
That sounds like authorization configuration. Read about roles and authorization.
member60 20-Nov-12 4:14am
   
my 5!
Sandeep Mewara 26-Nov-12 22:24pm
   
Thanks.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

    Print Answers RSS
Top Experts
Last 24hrsThis month
OriginalGriff 6,539
CHill60 3,490
Maciej Los 3,143
ppolymorphe 2,030
Jochen Arndt 1,975


Advertise | Privacy | Mobile
Web02 | 2.8.170525.1 | Last Updated 6 Nov 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100