当前位置: 首页>>代码示例>>C#>>正文


C# CurrentUserInfo.IsAuthenticated方法代码示例

本文整理汇总了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;
            }
        }
    }
开发者ID:KuduApps,项目名称:Kentico,代码行数:82,代码来源:Wishlist.ascx.cs

示例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;
        }
//.........这里部分代码省略.........
开发者ID:hollycooper,项目名称:Sportscar-Standings,代码行数:101,代码来源:EditToolbar.ascx.cs


注:本文中的CurrentUserInfo.IsAuthenticated方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。