Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C#4.0MVC3
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
Your Filters
Interested
Ignored
     
0 Sergey Alexandrovich Kryukov 545
1 OriginalGriff 498
2 sanket saxena 330
3 Abhinav S 280
4 thatraja 275
0 Sergey Alexandrovich Kryukov 8,372
1 OriginalGriff 4,830
2 Peter Leow 3,784
3 Maciej Los 3,515
4 Er. Puneet Goel 3,107


Advertise | Privacy | Mobile
Web01 | 2.8.140415.2 | Last Updated 6 Nov 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Use
Layout: fixed | fluid