protected void Page_Load(object sender, EventArgs e) { _ContentApi = new ContentAPI(); _Common = new Common(); _MessageHelper = _ContentApi.EkMsgRef; // Use ASP.Net Login Control // Ektron Login features and Ektron Membership Provide (MembershipProvider="EktronMembershipProvider") Ektron.Cms.Controls.Login ektronLogin = new Ektron.Cms.Controls.Login(); ektronLogin.AutoLogin = true; ektronLogin.AutoAddType = EkEnumeration.AutoAddUserTypes.Author; ektronLogin.Visible = false; // set translatable text values ((Literal)loginControl.FindControl("introText")).Text = _MessageHelper.GetMessage("first login message"); ((Label)loginControl.FindControl("UserNameLabel")).Text = _MessageHelper.GetMessage("username label"); ((Label)loginControl.FindControl("PasswordLabel")).Text = _MessageHelper.GetMessage("password label"); loginControl.LoginButtonText = _MessageHelper.GetMessage("generic login msg"); loginControl.TitleText = loginControl.LoginButtonText; loginControl.FailureText = String.Format(@"<div class='ui-widget errorMessage'><div class='ui-state-error ui-corner-all ui-helper-clearfix'><span class='ui-icon ui-icon-alert errorIcon'></span><h2>{0}</h2><div>{1}</div></div></div>", _MessageHelper.GetMessage("invalid username or password"), _MessageHelper.GetMessage("login helper text")); RegisterResouces(); //Check if user is logged in if (_Common.UserId > 0) { //HttpCookie cookEcm = Request.Cookies.Get("ecm"); //if (cookEcm != null && cookEcm.Expires.Ticks == 0) //{ // Response.Cookies["ecm"].Value = cookEcm.Value; // //Response.Cookies["ecm"].Expires = DateTime.Now.Date.AddDays(30); //} LoginSuceededPanel.Visible = true; LoginRequestPanel.Visible = false; } else { if (test.Value == "loginAttempt") { test.Value = ""; } LoginSuceededPanel.Visible = false; LoginRequestPanel.Visible = true; } }
public bool TestServerControl() { bool bReturn = false; try { //----- Build a login control, if nothing throws assume server controls are working. Ektron.Cms.Controls.Login testLogin = new Ektron.Cms.Controls.Login(); testLogin.Page = new System.Web.UI.Page(); testLogin.Fill(); if (testLogin != null) testLogin = null; bReturn = true; } catch (Exception exThrown) { //----- If something threw, record the last message. m_sLastError = exThrown.Message; bReturn = false; } return bReturn; }