title: C# Check user still logged with every action (getting info from API)
body: <p>I have a WPF application (written in C# using MVVM) where I start with a login window where users login. When the username and password are filled in I do a webrequest (POST) to our login page (at our coorperate website), where I POST the data, get a webresponse and when the response statuscode is OK and I receive a cookie I know i'm logged in succesfully.
  Further in my app I use that same cookie to call our API webpage (also via webrequests) to get all the data for in the app.</p>
  
  <p>The cookie has a expiration date (6h after creation). When i do a new webrequest and the cookie is expired, i need to show the login page again. After login the app has to resume where it left off.</p>
  
  <p>I know i have to change my app so it doesn't start with the login page, but with the main page and check if there's is a cookie (and it's not expired). 
  At launch there isn't a cookie set so it will show the login page.</p>
  
  <p>But how do i save the application when the cookie is expired (and i do a new webrequest), show the same login page &amp; process login (overwriting the cookie) and resume where i left off (re do the webrequest)?
  And how do I give notice to the main page from another page that the login page needs to show?</p>