Don't retain hidden field values from previous postback

Go To StackoverFlow.com

0

I'm working on a page where a user can update his/her profile. From this page, the user is able to upload a profile picture. I store a reference to this profile picture in a hidden field on the page that is dynamically created. This field is only usable for a single update and is only significant to server-side logic on postback; it is no longer valid afterwards. The problem I'm currently having is that if a user updates a profile then hits the back button in a browser, the values of these photo-related hidden fields are retained when they shouldn't be: it only ends up ruining my server-side logic. I could clear these hidden fields on page load through javascript, but is there a better way?

2012-04-04 03:06
by user1036767


0

clear the hidden field on postback like..

set the hidden field value on page load, if there is post back request to the page then set the value of hidden field to 0

2012-04-04 03:10
by Madan
Hi thanks for the response, the problem is after postback the user gets redirected to a different page. There isn't an opportunity to manipulate the hidden field. Maybe I can go ahead and clear the hidden on page load. Really hoping there would be an easier way - user1036767 2012-04-04 03:13
Ads