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 6363579
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T00:03:20+00:00 2026-05-25T00:03:20+00:00

Hi i have mvc2 application where i want to stop processing application when settings

  • 0

Hi i have mvc2 application where i want to stop processing application when settings file is set to offline and display offline page to the user.

i have decided to create in global.asax.cs switch that will check it web application is offline and pending result it will redirect to offline page or continue with processing page.

how ever when i try to run it with this code i get error:

Server Error in ‘/’ Application. Response is not available in this
context. Description: An unhandled exception occurred during the
execution of the current web request. Please review the stack trace
for more information about the error and where it originated in the
code.

Exception Details: System.Web.HttpException: Response is not available
in this context.

Source Error:

Line 25: if (!this.IsApplicationOnline()) Line 26:
{ Line 27: Response.Redirect(“~/Content/offline.html”,
true); Line 28: } Line 29: else

Source File: *\Global.asax.cs Line: 27

Stack Trace:

[HttpException (0x80004005): Response is not available in this
context.] System.Web.HttpApplication.get_Response() +3002456
easyccms.WebUI.MvcApplication.Application_Start() in
*Global.asax.cs:27

My code is as follows

protected void Application_Start()
        {
            if (!this.IsApplicationOnline())
            {
                Response.Redirect("~/Content/offline.html", true);
            }
            else
            {
                AreaRegistration.RegisterAllAreas();
                log4net.Config.XmlConfigurator.Configure();
                RegisterRoutes(RouteTable.Routes);
            }
        }
  • 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-25T00:03:21+00:00Added an answer on May 25, 2026 at 12:03 am

    Ok i have found a solution.

    I had to specify which response it is and therefore: added System.Web.HttpContext.Current

    and this works. Now i just presume there can be more then httpcontext

    System.Web.HttpContext.Current.Response.Redirect("~/Content/offline.html", true);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have asp.net MVC2 application. I am using VS2008 and want to hook up
I have an MVC2 application, and HttpHandler Library. The library, to simplify, serves an
I have a mvc2 application with a view like this <% using (Ajax.BeginForm(UserApprove, new
I have an asp.net mvc2 application that is using StructureMap 2.6 and NHibernate 3.x.
I have user control in my MVC2 app placed in the Content folder (it's
I have an ASP.NET MVC2 application that uses a parent controller to setup specific
I want to use System.Net.Mail.SendAync in an ASP.NET MVC2 application. I see that it
i m using .NET mvc2 for my application. I want some custom authorization on
I have a web application which was using Asp.net MVC2 . I Upgraded it
I am working in asp.net MVC2 application and I have question related to design

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.