Web part logic redirect overriding editing in CMS

Misty Garrick asked on November 9, 2018 16:57

Hi all,

I'm new to Kentico, so I apologize for any misuse of terminology.

I've created a web part. Its code checks to see if the user is a member or a non-member. If they're a non-member, they're redirected to a page that says the page is members only.

I created a widget with this web part and placed it in a page in the CMS editor. However, now when I try to go that page in the CMS, it's redirecting me to the "is members only" message page.

How then do I allow CMS users to edit the content of the page? Is there a setting in the widget or web part?

Thanks in advance for your help!

Correct Answer

Zach Perry answered on November 9, 2018 17:26

  1. How are you determining if they are a member? You can probably do this without creating a custom web part and using page permission.

  2. In your code you can detect the viewmode, I believe CMSContext.ViewMode is the code you need, and just check if it is livesite before redirecting.

0 votesVote for this answer Unmark Correct answer

Recent Answers

Misty Garrick answered on November 9, 2018 17:42

Awesome. Thank you so much! That's exactly what I was looking for.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.