Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7219135
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T21:36:18+00:00 2026-05-28T21:36:18+00:00

I am building an ASP.NET MVC3 computer support ticketing portal. There is a maintenance

  • 0

I am building an ASP.NET MVC3 computer support ticketing portal.

There is a maintenance state, where it is best to forbid the users from interacting with EF/Database, to avoid “collisions” I am currently getting.

I have an IMaintenanceDispatcher that has a boolean property IsOnMaintenance set to true by the business logic, whenever a background logic puts the portal in that state.

I need to redirect client requests to a parking page for the time of maintenance.

Where do I place the logic that will check if the IsOnMaintenance is true, and if so, do a redirect to a URL?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T21:36:43+00:00Added an answer on May 28, 2026 at 9:36 pm

    You could put it in an ActionFilterAttribute and apply that attribute to any applicable actions/controllers or globally.

    public class IsOnMaintenanceAttribute : ActionFilterAttribute
    {
        //You'll need to setup your IoC to inject this
        public IMaintenanceDispatcher InjectedMaintenanceDispatcher { get; set; }
    
        public override void OnActionExecuting(ActionExecutingContext filterContext)
        {
            object ticketIdObj;
            if (!filterContext.ActionParameters.TryGetValue("ticketId", out ticketIdObj))
                return;
    
            //Make sure it exists
            if (InjectedMaintenanceDispatcher.IsOnMaintenance(int.parse(ticketIdObj)))
            {
                var routeValues = new RouteValueDictionary(new {
                    action = "parkingpage",
                    controller = "maintenance",
                    area = "ticket" });
    
                filterContext.Result = new RedirectToRouteResult(routeValues);
                return;
            }
        }
    }
    

    Note, your action method parameters needs to contain a variable named ticketId for the filterContext.ActionParameters.TryGetValue to work.

    Note: I had assumed that an individual ticket is put into maintenance mode and you were wanting to check for that… but re-reading the question it seems like you want to put the whole area/site on hold. Even with that case, the ActionFilterAttribute example still holds… just not as different.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am building a new asp.net MVC3 web application for reporting and I want
I'm building a website with ASP.NET MVC3. When a user signs in, I pull
When building ASP.NET projects there is a certain amount of boilerplate, or plumbing that
I'm building ASP.NET MVC2 website that lets users store and analyze data about goods
I am building an ASP.NET website which will collect data from a user and
I'm building an ASP.NET MVC3 Website with EF and DB First Approach. I need
I am building a project using ASP.Net 4 and MVC3 using C#. The ASP.Net
I am developing an application in ASP.NET MVC3 in C#. I am currently building
I am building ASP.NET MVC3/Razor C# and I need two sides/interface base web aplication,
Building an ASP.NET MVC3 application at work and I'm trying to use a program

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.