protected void LoginButton_Click(object sender, EventArgs e)
        {
            string userName = UserNameBox.Text;
            string password = PasswordBox.Text;
            AuthenticationStandardLogonParameters parameters = new AuthenticationStandardLogonParameters(userName, password);
            SecurityStrategyComplex    security            = ConnectionHelper.GetSecurity(typeof(AuthenticationStandardProvider).Name, parameters);
            SecuredObjectSpaceProvider objectSpaceProvider = ConnectionHelper.GetObjectSpaceProvider(security);
            IObjectSpace logonObjectSpace = objectSpaceProvider.CreateObjectSpace();

            try {
                security.Logon(logonObjectSpace);
            }
            catch { }
            if (security.IsAuthenticated)
            {
                SetCookie(userName);
                FormsAuthentication.RedirectFromLoginPage(userName, true);
            }
            else
            {
                ClientScript.RegisterStartupScript(GetType(), null, "errorMessage();", true);
            }
            security.Dispose();
            objectSpaceProvider.Dispose();
        }
Example #2
0
 protected void Page_Unload(object sender, EventArgs e)
 {
     objectSpace.Dispose();
     security.Dispose();
     objectSpaceProvider.Dispose();
 }