+1-888-365-2779
Try Now
More in this section

Forums / General Discussions / Issues with password-protected user controls

Issues with password-protected user controls

5 posts, 0 answered
  1. Stephen
    Stephen avatar
    70 posts
    Registered:
    09 Jun 2009
    09 Oct 2009
    Link to this post
    I have a page with several password-protected user controls on it. Those user controls check credentials from a third party database and redirect users to login page if they are not login. The problem is that I cannot modify the content block on this page unless I logged in as a member. Is there anyway to get around of it? Thanks.
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    09 Dec 2016
    12 Oct 2009
    Link to this post
    Hi Developer,

    You can check the current mode of the page and force authentication only for the public site(front end) of your website. You can use CmsPageMode enum (Live, Preview,  Edit, Admin.)

    Sample:

    if (!CmsPageMode.Live)
         {
             // do something here
         }

    I hope this helps.

    Best wishes,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. Stephen
    Stephen avatar
    70 posts
    Registered:
    09 Jun 2009
    13 Oct 2009
    Link to this post
    Can you give a bit more details how to use CmsPageMode? It does not return a boolean value. Thanks.
  4. Stephen
    Stephen avatar
    70 posts
    Registered:
    09 Jun 2009
    13 Oct 2009
    Link to this post
    I found the solution. Thanks.

    Telerik.Cms.Web.CmsPageBase page = this.Page as Telerik.Cms.Web.CmsPageBase;   
    if (page.PageMode != Telerik.Cms.Web.CmsPageMode.Edit)   
    {   
        //something  
    }   

  5. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    09 Dec 2016
    14 Oct 2009
    Link to this post
    Hello Developer,

    CmsPageMode is an enumerator. Note that the page is null in edit mode. You can work with query strings as well.

    if ( HttpContext.Current.Request.QueryString[ "cmspagemode" ] == "edit" )
                {
                  // do something here
                }

    Greetings,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Register for webinar
5 posts, 0 answered