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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T18:24:54+00:00 2026-06-03T18:24:54+00:00

I have the strangest problem! I have an ASP.NET website application (luckily not yet

  • 0

I have the strangest problem! I have an ASP.NET website application (luckily not yet live). Yesterday and everyday before, I could run the application without error. It was working fine when I turned the computer off late last night. When I ran the application today, I got a strange message telling me that my website was offline and that I should remove the app_offline.htm page from my root directory to put it back online.

I have never seen this message or page before, so I searched online to find that apparently SQL Server can put it there temporarily while it’s busy to stop any more incoming requests (or something similar). Its proper use is to stop requests going to your site when you are updrading or doing maintenance. I proceeded to remove it as suggested. I cleaned and built the solution and then tried to run it. It no longer runs.

Now, I get an error in my MasterPage code behind where I normally access the controls on the MasterPage in the Page_Load event handler (shown below).

protected void Page_Load(object sender, EventArgs e)
{
    breadCrumb.BreadCrumbs = BreadCrumbs;
    header.MenuItems = MenuItems;
    footer.Footers = Footers;
    head.Controls.Add(CreateCssLink("~/Stylesheets/main.css", "screen"));
    head.Controls.Add(CreateJavaScriptLink("~/Scripts/site.js"));
    if (Context.Session != null && Session["layout"] == null) Session["layout"] = "single";
    if (!ArePreferencesVisible) preferences.Visible = false;
}

I want to be clear here… there are no errors in this code. There are correctly named elements in the MasterPage that correspond to those in this code. It has always worked as expected up until today and I have not changed any code since it was last working. I now get a NullReferenceException on the first line because the breadCrumb element is null. In fact, all the elements from the page that are referenced here are null.

Normally the page elements have been initialised by the time the Page_Load event is raised. What can have caused this to stop happening?

I have double checked that the MasterPage and its code behind file are still connected and they are. I also tried moving this code to the Page_LoadComplete event handler, but the controls had still not been initialised, even at that stage. I shouldn’t really have to change the code because it worked just fine before.

I also commented out this code and the website ran, albeit without any styles. Interestingly, when I returned the original code to the event handler and refreshed the page, it actually worked again just as it used to. I loaded a number of different pages successfully and I thought it had fixed itself, so I restarted the application and then got the same error again. No amount of cleaning, building, changing solution configuration or restarting the application and Visual Studio make any difference.

I’m not sure if the app_offline.htm is a red herring, but I’ve never seen that before either so it might be connected somehow. From what I read, it seems that just removing it causes the server to restart the application domain automatically, so I can’t see the connection.

I really hope someone has come across this bizarre situation before because I’m all out of ideas and I can’t run my website until this is fixed.

  • 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-06-03T18:24:56+00:00Added an answer on June 3, 2026 at 6:24 pm

    Ok, so I finally tracked down the problem. I had an earlier backup of the website from a few days ago, so I loaded that up and it worked, albeit missing the last few days’ work. I copied the latest project code into the Visual Studio > Projects folder leaving the old code in the Visual Studio > Website folder. I loaded the solution and it ran fine again.

    I basically compared the Website files, updating each one in turn and periodically running the application. Eventually, the application stopped working. The last file that I had updated was a MasterPage file that extended the MasterPage that had the problem.

    What I had done was comment out an empty Page_Load event handler in the MasterPage. I don’t understand why that would cause this problem, so any comments explaining that would be helpful and appreciated.

    This MasterPage is only used on the home page and a few others, so that explains why I didn’t come across the problem the night that I changed it. (I hadn’t viewed any pages that used that MasterPage after making the change). I wish I had because it would have been much easier to track down then, but such is life.

    So I replaced all of my latest code, added the empty Page_Load event handler in the MasterPage again and finally, everything is working again.

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

Sidebar

Related Questions

I am working on ASP.Net 2.0 website and I have a strange problem. First
I have a strange problem in my ASP.Net 3.5 application. When multiple users try
I'm having a strange problem here... I have an ASP.NET 3.5 application that has
I have an asp.net c# website that I am having a problem getting the
I have strange problem with disposing entity framework connection in asp.net mvc application. I
Today I faced a strange problem in C#. I have an ASP.NET page where
I am stuck with redirecting problem in ASP.NET MVC project. I have mapped tables
I'm working with ASP.Net Membership with FormsAuth and have run into a strange problem.
I'm experiencing a very strange problem... I have a regular ASP.Net webpage with a
I have a strange issue with an Asp.NET MVC application. Using Asp.NET MVC 3

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.