10

We have installed the razor mediator, and are now testing to see if we can save a Razor template building block. When saving a TBB we got the following message:

Attempting to create Session - razor config attribute 'adminUser' is required to use this feature Unable to save Template Building Block (tcm:0-0-0)

We attempted a quick fix by simply configuring an admin user, but to get that working will require that we configure impersonation. (Which might be worth considering, but that's not what this question is about.)

The question is: why doesn't this work when we have no imports configured? The documentation says it shouldn't be necessary. I've just had a quick look at the code, and GetImportTemplateContent(), seems to be the only place that creates a Session. This in turn is only called by ImportIncludes(), which only calls it if an include is found in the configuration or in the content. I don't have the opportunity right now to get this under a debugger, so any insights would be welcomed.

Edit: Would there be any downside in having the Session property simply use the other overload of Tridion's Session constructor if no admin were configured?

5

I think it may have something to do with the option to allow Where Used relationships for Razor TBBs, I haven't traced the code through, but I think when a template is compiled it updates the Where used relationships, even if there are no imports, but for this it needs a session.

Try setting includeImportWhereUsed to false, and while you are at it probably includeConfigWhereUsed to false also (in Tridion.ContentManager.config).

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.