Unless I've misunderstood just add a log off link to the "Logged in template" and add a click event to it and log off in the code.
I think off the top of my head
FormsAuthentication.SignOut()
will do that
Then for the login, stick a link to your login page in your "anonymous template".