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

Forums / Developing with Sitefinity / How to test if page is in designer mode?

How to test if page is in designer mode?

5 posts, 0 answered
  1. bemara57
    bemara57 avatar
    135 posts
    Registered:
    27 Mar 2008
    05 Mar 2010
    Link to this post
    For controls there is "this.DesignMode" to test if the control is in the admin designer mode. Works great so you do not have to render in that mode to avoid problems. But I have an HttpHandler that I also do not want to run in designer mode, but "Page" does not have this property. Is there another way to test this besides from the control?
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    05 Mar 2010
    Link to this post
    Hello bemara57,

    You can use QueryString key to check whether you are in edit mode.

    if (HttpContext.Current.Request.QueryString["cmspagemode"] != "edit")


    All the best,
    Ivan Dimitrov
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  3. David Pearson
    David Pearson avatar
    54 posts
    Registered:
    17 Jul 2012
    09 Mar 2010
    Link to this post
    Thanks Ivan, just what I was searching for.

    David
  4. Daniel Plomp
    Daniel Plomp avatar
    952 posts
    Registered:
    18 Feb 2004
    30 Nov 2010
    Link to this post
    And how should you deal with UserControls that require authentication? Like I have some code in my UserControls:

    if (User.Identity.Authenticated == true)
    {
        ....
    }

    Which is also true when you are logging in with a Sitefinity user.
    I now check it with this code:

    if (UserManager.Default.RoleProvider.Name != "Sitefinity")
     {
        if (HttpContext.Current.User.Identity.IsAuthenticated)
        {
           ...
        }
    }

    Is this okay, or is there a better way?

    Thanks,
    Daniel
  5. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    30 Nov 2010
    Link to this post
    Hello Daniel,

    HttpContext.Current.User.Identity.IsAuthenticated looks fine,

    Greetings,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Register for webinar
5 posts, 0 answered