File: D:/HostingSpaces/TDijk1/erp-apps.eu/wwwroot/CMSWebParts/Pux/Membership/Logout/SignOutUser.ascx.cs
using CMS.DataEngine;
using CMS.DocumentEngine;
using CMS.Helpers;
using CMS.Membership;
using CMS.PortalControls;
using CMS.SiteProvider;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class CMSWebParts_Pux_Membership_Logout_SignOutUser : CMSAbstractWebPart
{
#region "Properties"
public bool ShouldLogout
{
get
{
return ValidationHelper.GetBoolean(GetValue("ShouldLogout"), false);
}
set
{
SetValue("ShouldLogout", value);
}
}
public string RedirectUrl
{
get
{
return ValidationHelper.GetString(GetValue("RedirectUrl"), string.Empty);
}
set
{
SetValue("RedirectUrl", value);
}
}
#endregion
public override void OnContentLoaded()
{
base.OnContentLoaded();
SetupControl();
}
protected void SetupControl()
{
if (this.StopProcessing)
{
// Do not process
}
else
{
if (Enabled && ShouldLogout && ViewMode == CMS.PortalEngine.ViewModeEnum.LiveSite)
{
string redirectUrl = RedirectUrl;
if (string.IsNullOrEmpty(redirectUrl))
{
SettingsKeyInfoProvider.GetValue("CMSDefaultAliasPath", CurrentSiteName);
redirectUrl = DocumentURLProvider.GetUrl(redirectUrl);
}
if (AuthenticationHelper.IsAuthenticated())
{
AuthenticationHelper.SignOut();
}
Response.Cache.SetNoStore();
URLHelper.Redirect(redirectUrl);
}
}
}
public override void ReloadData()
{
base.ReloadData();
SetupControl();
}
protected void Page_Load(object sender, EventArgs e)
{
}
}