title: ASP.NET ViewState postback with page refresh and bookmarks
body: <p>The ASP.NET ViewState feature can sometimes be a double edged sword. I rely on it on most of my projects and it speeds up development considerably.</p>
  
  <p>My problem is that sometimes users will try to refresh a page which will cause the viewstate to be lost, other times the user might want to bookmark a page but when the get back the viewstate will be lost.</p>
  
  <p>Modern browsers will display a silly dialog when a user tries to refresh a page that is the result of a POST operation (e.g. asp postback) which is not desirable at all.</p>
  
  <p>I wonder is their a way to continue using ViewState and the postback model but without the drawback of the refresh dialog box. (and if possible bookmark the page.)</p>
  
  <p>An example of what i might want to do is having a page with records and checkboxes next to them, the user has the option to check all the records they want to delete and then click on a delete button. After the user clicks delete the records are analyzed on the server and the new page lists all the records that were selected with a confirm delete button. Now if the user clicks refresh they get this silly box to confirm if they want to post or not.</p>
  
  <p>I understant that ViewState is the result of using the Post Back model which means that most asp.net pages are the result of a POST operation, but i wonder if there are any ways around it.</p>
  
  <p>Workarounds that i thought might work: <br />
  In the Page_Unload event save the viewstate in the session with a unique id and redirect the user to the same page with the unique id as a query string parameter, after the page loads with a unique id in the url the viewstate is loaded from the session and injected into the current page. Such a method will allow to user to refresh the page and always get back the same results.</p>
  
  <p>P.S.
  I understand that i can use <code>Response.Redirect()</code> and/or query strings but i want to use the simplicity of <code>ViewState</code></p>