问题描述:

I have a ASP.NET Web Forms page that does a good amount of processing in the page_load event. Ideally I would display a loading gif to my user while the page is loading. Since all the processing is on page_load, the page's html never gets rendered and all the user sees is a blank page.

I tried/brainstormed a few ideas, none of which were successful.

  • Moved processing to unload event. This doesn't work because Request and Response objects are not available at this point.
  • Called a page method via ajax. This doesn't work because I cannot access a non-static variable. The processing involves access to the page request and response.
  • A staging page that contains only the loading gif and on page load (client-side) redirects to the page that does the processing. I tried Method 1 from this article but the problem here is that the process itself contains a redirect. In other words, I can't point it to page1.aspx (the page that does the processing) because page1.aspx ultimately redirects to page2.aspx.

Any other ideas?

网友答案:

As requested :

Couldn't you just call the complete page using a JQuery $.get() and render the results to a div?

相关阅读:
Top