views:

494

answers:

1

I'm having a strange problem here...

I have an ASP.NET 3.5 application that has a GridView and a SqlDataSource on the Default.aspx. The GridView is databound to the SqlDataSource. The GridView has a button for each row called "View" that sends the user to a separate page where the row can be edited.

I have two installations of this application - one on my development laptop, which is XP running IIS 5.1 and another on a Windows 2003 server running IIS 6.0. The web.config files are identical, the IIS configuration properties are identical, and it's hitting the same database.

On my laptop the behavior I see is "correct", and goes like this: 1. Open page, select page 15 of the datagrid via the paging links. 2. Click the view button for a record, view the edit page. 3. Click the "Back" button and you are returned to the Default.aspx page, and the GridView is reloaded/refreshed with new data. Clicking View again takes you to the proper item.

On the server, I see this: 1. Open page, select page 15 of the datagrid via the paging links. 2. Click the view button for a record, view the edit page. 3. Click the "Back" button and you are returned to the Default.aspx page, and the GridView is NOT reloaded with new data (it pops up immediately). Clicking View again takes you to WRONG item.

Obviously there's some sort of caching problem, but I can't figure it out...any ideas?

A: 

I'm not sure of the exact reason for it, or the cause of it, but as I expected, it was a caching problem. When I add the statement:

Response.CacheControl = "no-cache";

To the Default.aspx.cs, the problem goes away. It's not surprising that the back button screws up the request pattern, but I did find it surprising that the IIS 5.1 running on my laptop handles the back button better than IIS 6.0...

Sam Schutte