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?
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