Common Security PassThrough
Common_SecurityPassThrough_CSharp\SecurityPassThrough_Forms_CSharp\Login.aspx.cs
// Copyright 2010 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
{
    // This method is called immediately after the user is logged in by the Login 
    // control.
    protected void Login1_LoggedIn(object sender, System.EventArgs e)
    {
        // Capture the username and password in an ADF Identity object
        ESRI.ArcGIS.ADF.Identity adfUserIdentity = new ESRI.ArcGIS.ADF.Identity();
        adfUserIdentity.UserName = Login1.UserName;
        adfUserIdentity.Password = Login1.Password;

        // Save the identity in the Session. This will be used when Default.aspx 
        // loads to set the identity of the map resource.
        Session["userIdentity"] = adfUserIdentity.ToString();
    }
}