Domanda

We have an ASP.NET 3.5 application which we have created for a logistics company, which allows their customers to input deliveries/jobs and get them onto the system.

The core page in the system is the Add Job screen as as you can imagine - as the user builds up their job, we store some information of this in the Session. Then when they commit the job, or in the Page_Load event when the request is not a postback, the session is cleared ready for the next job.

We are having an issue with a small percentage of the customers, in which the users sessions appear to be being wiped before the commit happens - the users have assured us they are not trying to use multiple sessions (i.e. 2 windows of the same page). We put in some error trapping that logged whenever the sessions were cleared on that page, and it seems that 'clear session' in the Page_Load event is firing a few seconds before they click submit. Please note we have a lot of autopostback controls on this page.

Are there any ASP.NET quirks, or browser quirks for that matter, that will mean the IsPostback property will incorrectly be false? This is a very sporadic issue and we are having no luck in replicating this!

È stato utile?

Soluzione

As adviced by many comments the session IS the wrong solution. It could be reset by a lot of things (app pool recycling for example).

You should not force the user not to use different browsers or tabs, so the right choice is move data to ViewState/Control state.

If for some weird reason you still have to keep data in the session consider switching to a persistant session storage (i.e. using sql Server).

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top