本文整理汇总了C#中CurrentUserInfo.IsAuthenticated方法的典型用法代码示例。如果您正苦于以下问题:C# CurrentUserInfo.IsAuthenticated方法的具体用法?C# CurrentUserInfo.IsAuthenticated怎么用?C# CurrentUserInfo.IsAuthenticated使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CurrentUserInfo
的用法示例。
在下文中一共展示了CurrentUserInfo.IsAuthenticated方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetupControl
/// <summary>
/// Initializes the control properties.
/// </summary>
protected void SetupControl()
{
if (this.StopProcessing)
{
// Do nothing
}
else
{
currentUser = CMSContext.CurrentUser;
if (currentUser.IsAuthenticated())
{
// Control initialiazation
lblTitle.Text = GetString("Ecommerce.Wishlist.Title");
btnContinue.Text = GetString("Ecommerce.Wishlist.btnContinue");
mSKUId = QueryHelper.GetInteger("productID", 0);
currentSite = CMSContext.CurrentSite;
// Set repeater transformation
repeater.TransformationName = this.TransformationName;
repeater.ItemSeparator = this.ItemSeparator;
if ((currentUser != null) && (currentSite != null))
{
if ((!RequestHelper.IsPostBack()) && (mSKUId > 0))
{
int addSKUId = mSKUId;
// Get added SKU info object from database
SKUInfo skuObj = SKUInfoProvider.GetSKUInfo(addSKUId);
if (skuObj != null)
{
// Can not add option as a product
if (skuObj.SKUOptionCategoryID > 0)
{
addSKUId = 0;
}
else if (!skuObj.IsGlobal)
{
// Site specific product must belong to the current site
if (skuObj.SKUSiteID != currentSite.SiteID)
{
addSKUId = 0;
}
}
else
{
// Global products must be allowed when adding global product
if (!ECommerceSettings.AllowGlobalProducts(currentSite.SiteName))
{
addSKUId = 0;
}
}
}
if (addSKUId > 0)
{
// Add specified product to the user's wishlist
WishlistItemInfoProvider.AddSKUToWishlist(currentUser.UserID, addSKUId, currentSite.SiteID);
LogProductAddedToWLActivity(addSKUId, ResHelper.LocalizeString(skuObj.SKUName), currentSite.SiteID);
}
}
if (mSKUId > 0)
{
// Remove product parameter from URL to avoid adding it next time
string newUrl = URLHelper.RemoveParameterFromUrl(URLRewriter.CurrentURL, "productID");
URLHelper.Redirect(newUrl);
}
}
}
else
{
// Hide control if current user is not authenticated
this.Visible = false;
}
}
}
示例2: Page_Load
/// <summary>
/// Handles the Load event of the Page control.
/// </summary>
protected void Page_Load(object sender, EventArgs e)
{
// Do not process control by default
StopProcessing = true;
// Keep frequent objects
cui = CMSContext.CurrentUser;
PageInfo pi = CMSContext.CurrentPageInfo;
if (pi == null)
{
IsPageNotFound = true;
pi = OnSiteEditHelper.PageInfoForPageNotFound;
}
ucUIToolbar.StopProcessing = true;
largeCMSDeskButton = !cui.UserSiteManagerAdmin;
// Check whether user is authorized to edit page
if ((pi != null) && cui.IsAuthenticated() && cui.IsEditor && ((IsPageNotFound && pi.NodeID == 0) || cui.IsAuthorizedPerTreeNode(pi.NodeID, NodePermissionsEnum.Read) == AuthorizationResultEnum.Allowed))
{
// Enable processing
StopProcessing = false;
// Check whether the preferred culture is RTL
isRTL = CultureHelper.IsUICultureRTL();
// Add link to CSS file
CSSHelper.RegisterCSSLink(Page, "Design", "OnSiteEdit.css");
// Filter UI element buttons
ucUIToolbar.OnButtonFiltered += ucUIToolbar_OnButtonFiltered;
ucUIToolbar.OnButtonCreated += ucUIToolbar_OnButtonCreated;
ucUIToolbar.OnButtonCreating += ucUIToolbar_OnButtonCreating;
ucUIToolbar.OnGroupsCreated += ucUIToolbar_OnGroupsCreated;
ucUIToolbar.IsRTL = isRTL;
// Register edit script file
RegisterEditScripts(pi);
if (ViewMode == ViewModeEnum.EditLive)
{
popupHandler.Visible = true;
IsLiveSite = false;
MessagesPlaceHolder.IsLiveSite = false;
MessagesPlaceHolder.Opacity = 100;
// Display warning in the Safe mode
if (PortalHelper.SafeMode)
{
string safeModeText = GetString("onsiteedit.safemode") + "<br/><a href=\"" + URLHelper.RawUrl.Replace("safemode=1", "safemode=0") + "\">" + GetString("general.close") + "</a> " + GetString("contentedit.safemode2");
string safeModeDescription = GetString("onsiteedit.safemode") + "<br/>" + GetString("general.seeeventlog");
// Display the warning message
ShowWarning(safeModeText, safeModeDescription, "");
}
ucUIToolbar.StopProcessing = false;
// Ensure document redirection
if (!String.IsNullOrEmpty(pi.DocumentMenuRedirectUrl))
{
string redirectUrl = CMSContext.ResolveMacros(pi.DocumentMenuRedirectUrl);
redirectUrl = URLHelper.ResolveUrl(redirectUrl);
ShowInformation(GetString("onsiteedit.redirectinfo") + " <a href=\"" + redirectUrl + "\">" + redirectUrl + "</a>");
}
}
// Mode menu on live site
else if (ViewMode == ViewModeEnum.LiveSite)
{
// Hide the edit panel, show only slider button
pnlToolbarSpace.Visible = false;
pnlToolbar.Visible = false;
pnlSlider.Visible = true;
imgSliderButton.ImageUrl = GetImageUrl("CMSModules/CMS_PortalEngine/OnSiteEdit/edit.png");
imgSliderButton.ToolTip = GetString("onsiteedit.editmode");
imgSliderButton.AlternateText = GetString("onsitedit.editmode");
pnlButton.Attributes.Add("onclick", "OnSiteEdit_ChangeEditMode();");
imgMaximize.Style.Add("display", "none");
imgMaximize.AlternateText = GetString("general.maximize");
imgMaximize.ImageUrl = GetImageUrl("CMSModules/CMS_PortalEngine/OnSiteEdit/ArrowDown.png");
imgMinimize.ImageUrl = GetImageUrl("CMSModules/CMS_PortalEngine/OnSiteEdit/ArrowUp.png");
imgMinimize.AlternateText = GetString("general.minimize");
pnlMinimize.Attributes.Add("onclick", "OESlideSideToolbar();");
// Hide the OnSite edit button when displayed in CMSDesk
pnlSlider.Style.Add("display", "none");
}
}
// Hide control actions for unauthorized users
else
{
plcEdit.Visible = false;
}
//.........这里部分代码省略.........