Common Security
Common_Security_CSharp\Login.aspx.cs
// Copyright 2011 ESRI
// 
// All rights reserved under the copyright laws of the United States
// and applicable international laws, treaties, and conventions.
// 
// You may freely redistribute and use this sample code, with or
// without modification, provided you include the original copyright
// notice and use restrictions.
// 
// See the use restrictions.
// 


public partial class Login : System.Web.UI.Page
{
    protected void Page_Load(object sender, System.EventArgs e)
    {
        // Check whether the user has just clicked the Logout link
        // on the Default page and has been redirected to the Login.aspx
        // page. If so, we remove some session objects so that if the
        // user logs back in, no evidence of the previous session is present.
        if (Session["keysToRemove"] != null)
        {
            System.Collections.Generic.List<string> keysToRemove =
                (System.Collections.Generic.List<string>)Session["keysToRemove"];

            foreach (string keyToRemove in keysToRemove)
                Session.Remove(keyToRemove);
        }

        // Remove the session object storing which keys to remove
        Session.Remove("keysToRemove");
    }
}