0

I have an ASP.NET Forms application, Framework version 4.5, IIS 7.5 in Windows 2008 Server R2 Standard. Sporadically I get a blank page(screenshot below). When I reset the website in IIS the problem gets fixed.. but then happens again in 2/3 days. Web.config file contains "default.aspx" on top as the default document.

In my application, default.aspx is an empty file that gets created on applications start-up - doesn't contain any code/content in it. My guess is that IIS keeps the blank page in cache and delivers the blank page sometimes. All other pages in the solution are virtual pages without physical existence. However, hitting other URLs loads the contents correctly.

I have already made the following attempts that did not solve the problem:

  1. IIS output caching - Prevent all caching for both user-mode and kernel-mode.
  2. Added following code block in Global.asax in order to fix the issue to load default document

    protected void Application_BeginRequest(Object sender, EventArgs e)
    {
      var app = (HttpApplication)sender;
      if (app.Context.Request.Url.LocalPath.EndsWith("/"))
      {                   
      app.Context.RewritePath(string.Concat(app.Context.Request.Url.LocalPath, "default.aspx"));
      }
    }
    

Can someone come up with some clue? Thanks in advance :)

Screenshot of the blank page

shamal
  • 1
  • 3
  • from control panel -> in window feature on or off -> internet Information Services -> common http -> check the static content checkbox and verify all check boxes to be checked . – Nazir Ullah Jun 08 '16 at 09:36
  • @Nazir, thanks for your reply. Can't really follow the path you mentioned in 2008 server. However, I can see the handler name StaticFile at the bottom of the Handler Mapping list on the web site. – shamal Jun 08 '16 at 09:58
  • in run command type (control panel) then click on Uninstall a program when open at the right side select the "turn the window feature on or off" then popup dailog open "internet Information Services" -> common http features -> check the static content checkbox – Nazir Ullah Jun 08 '16 at 10:23
  • Thanks, I found Static Content installed under Server Manager -> Web Server (IIS) -> Common HTTP features. – shamal Jun 08 '16 at 10:43
  • your problem is resolve by this please let me know? – Nazir Ullah Jun 09 '16 at 03:39
  • @Nazir, it was not an issue relevant to Static Content module as it is already installed and begin used by the web site. However thanks for the help. I have done a workaround (see answer) and keeping it under observation. – shamal Jun 09 '16 at 08:19

1 Answers1

0

I think the issue occurs because of the way application is designed in regards to virtual pages. There is a "default.aspx" virtual page in the application as well as a static file (which is just an empty file) with the same name in the root folder. My best guess is the handler sometimes deliver the static page instead of the virtual page, and therefore, the blank screen is displayed.

I've deployed a work around where I replaced the static file default.aspx with index.html. Just to be sure to redirect to default page in case the index.html file is loaded, following piece of codes added:

    <meta charset="UTF-8">
    <meta http-equiv="refresh" content="0; url=default.aspx" />

    <script>
        window.location.href = "default.aspx";
    </script>

So far it looks good but I will keep an eye on the application's behavior.

shamal
  • 1
  • 3