Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C#4.0 MVC3
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
Edited 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 at 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 at 26-Nov-12 22:25pm
   
That sounds like authorization configuration. Read about roles and authorization.
member60 at 20-Nov-12 4:14am
   
my 5!
Sandeep Mewara at 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
0 OriginalGriff 298
1 Sergey Alexandrovich Kryukov 181
2 Yogesh Kumar Tyagi 165
3 ChauhanAjay 156
4 Richard Deeming 150
0 Sergey Alexandrovich Kryukov 6,218
1 OriginalGriff 5,413
2 CPallini 2,473
3 Richard MacCutchan 1,627
4 Abhinav S 1,530


Advertise | Privacy | Mobile
Web01 | 2.8.140814.1 | Last Updated 6 Nov 2012
Copyright © CodeProject, 1999-2014
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