Web Site Content Path Macro

Joshua Adams asked on June 3, 2016 16:19

I need to have the ability to have the Default Alias Path, under Settings -> Content -> Web Site Content resolve a macro that I place into that field. I have already found that the form control used is a path selector. I can't modify the database field though, because it is a built in setting, unless I want to write directly to the db, which I usually try to avoid at all costs. Any ideas on what to do here? Is there some setting that I am missing? Also, tried to enter the macro regardless, and it doesn't resolve at all.

Our site is using windows authentication, and I need to have the ability to redirect the user to the appropriate page based on a field in the user object. I have tried to override the authenticate execute handler, with no luck.

Recent Answers

Zachary Perry answered on June 3, 2016 19:39 (last edited on June 3, 2016 19:40)

You can change the module to allow you to edit it, might want to do a backup first. I think the module you need is Content: SELECT * FROM dbo.CMS_Resource cr WHERE cr.ResourceName = 'CMS.Content'

If you change "ResouceInDevelopment" to 1 in that table, you will be able to modify the settings.

Even if you change it, I am not 100% the macro will still get resolved. You could set up the default path to be a page that redirects the user.

EDIT: This Post might explain a little more about "unlocking" modules

0 votesVote for this answer Mark as a Correct answer

Joshua Adams answered on June 3, 2016 19:42

Thanks for the info, I guess thinking through it, this won't event garauntee that the macro would be resolved, as you brought up. Not a fan of windows authentication customizations...Any idea on the best approach to knocking this out quickly? I know that the Kentico Default Alias Path works, event with windows authentication, which was why I was drawn to that, maybe if I can find that in the code, or override it, I will have better luck. Anyone know where I can find that spot or class to override?

0 votesVote for this answer Mark as a Correct answer

Jan Hermann answered on June 5, 2016 11:36

I am writing this from my phone with minimal access to any sources, but please try to move your code to session start event. If it doesn't help I would simply make a web part or a macro (or you could even take advantage of the Random redirection web part), place it on the master page a redirect your user to target page and then set cookie/session variable to nor redirect again.

0 votesVote for this answer Mark as a Correct answer

Joshua Adams answered on June 6, 2016 18:18

Jan, I tried that, and for some reason it didn't work either. May be a lifecyle issue on my part, but I did find a potential solution. Its not pretty, but does what I need it to do. I set the default page alias to a selector page, where the user will select their facility if they did have one, otherwise, there is a webpart that looks up their facility and redirects them. Seems to be working just right, but now it seems that some of the users that come in are coming under the public user, and windows authentication isn't creating an account for them. Any reason that this could occur(setting or something that I may be missing?) Seems like it would be related to active directory and how it is set up.

Thanks for the help everyone.

0 votesVote for this answer Mark as a Correct answer

Pedro Costa answered on June 6, 2016 18:41

I would suggest storing the result of the selection in a cookie first, and once auth has kicked in - hopefully after landing on the correct page - ensure the value in the cookie is set to the user's field using a Global event, like in this example https://docs.kentico.com/display/K8/Handling+custom+external+authentication

This way, on the selection page you don't need auth to have kicked in yet (I find that strange but have never setup Kentico with AD) however do ensure that you check the cookie and redirect the user straight away if it's already present.

Hope this helps, P.

0 votesVote for this answer Mark as a Correct answer

Joshua Adams answered on June 6, 2016 18:45

If each user is coming in as the public user though, won't this solution not work? Ideally, I want for each person that hits the site to get an account, but it is only happening with people at their location, all others from the other locations that hit the site show up under public. I have been told that all of the people are in the active directory as well, which throws a big curveball in here. May have to read up on what could be causing this.

0 votesVote for this answer Mark as a Correct answer

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