title: ASP.net user control nightmare
body: <p>I have implemented a user control that I reuse on several pages. However, I have run into variety of issues such as session maintenance across pages, session clearing on navigating away - essentially control state maintenance, that I am wondering that all this is worth the headache. </p>
  
  <p>Every time the page is loaded, a control is added to it, I use session to re-create its  state, where applicable. When I navigate away from a page, I clear the session through javascript window.onunload with the web method. Window.onunload has been giving me trouble by executing AFTER the new page_load event hence creating a situation that is very difficult to deal with. </p>
  
  <p>Any tips on how to fix this w/o giving up on user controls all together? 
  What is the other way to re-use code w/o ripping one's hair out?
  Thanks!</p>