Friday, January 23, 2009

Is page refreshing a postback?


If the page refreshing is after a postback (e.g. a postback caused by clicking a submit button), then this page refreshing will make IsPostBack=true. Otherwise, this page refreshing will have IsPostBack=false.

Wednesday, January 7, 2009

Back button and "Page expired" page

On one page of my portal, I switch the radio buttons several times and then click Back button of IE, it shows "Page expired" page. When I click Back button multiple times, IE sometimes shows "page expired" page, sometimes shows the page having the radio buttons.

Since my portal uses window live id, ajax, I thought they may be the causes. So I created two sites having the same function but one is WLID enabled and the other isn't. And I also tested with two sites having the same function but one is ajax enabled and the other isn't. My final result is they are NOT the cause of the "page expired" page.

I found some articles online mentioned that the cache need to be enabled to kill the "page expired" page. But my site has already been cache enabled.

Then I have to onion debug. After stripping most of the code, I lock down to the web.config. The web.config has this:

After I remove this setting, "page expire" behavior changed but not disappear totally. I am sure this setting contribute to "page expired" issue because this setting cleary introduce this issue to a test site whose Back button works correctly.

Then I continue to narrow down and find that a custom user control that I borrowed from the previous release also causes "page expired".

By further digging into the custom user control, I found it is the File upload control causing "page expired".

In summary, by this long debugging I found these are the root causes for "page expired" when I clicks Back button:

1. the trace setting in web.config.
2. ASP.NET's File Upload Control.

Thursday, January 1, 2009

ASP.NET Life Cycle