we are using sessions and web services to log in and out.

we are using the default master page which comes with visual studio 2012 if you go to create a 'web forms c# project' rather than an empty ASP application.

What we want is for the master page to detect an active session. If the session is active, the button 'log in' should change to 'log out' and the 'register' button should be removed.

How can this be achieved? Any links to examples, code samples, document etc?