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 10:25am
Edited 6-Nov-12 13: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 Maciej Los 310
1 OriginalGriff 285
2 Afzaal Ahmad Zeeshan 200
3 Sergey Alexandrovich Kryukov 195
4 BillWoodruff 180
0 OriginalGriff 6,499
1 Sergey Alexandrovich Kryukov 6,048
2 DamithSL 5,193
3 Manas Bhardwaj 4,657
4 Maciej Los 4,120


Advertise | Privacy | Mobile
Web04 | 2.8.1411022.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