Page preview not loading after migrating to Kentico 13

Srikrishna Podduturi asked on September 26, 2022 15:44

Hi,

I have migrated our website from Kentico 12 to Kentico 13. The page tab is not loading after the migration. Below is the stack trace of error in event log

    An unhandled exception has occurred while executing the request.
Message: Try reloading the administration interface. The user was not found in the JWT token, nor in the current virtual context URL.

Exception type: CMS.Helpers.InvalidVirtualContextException
Stack trace:
at Kentico.Content.Web.Mvc.VirtualContextPrincipalRetriever.GetPrincipal(String jwtToken)
at Kentico.Content.Web.Mvc.VirtualContextRequestPrincipalRetriever.Retrieve(HttpRequest request)
at Kentico.Web.Mvc.AuthenticationHandler.HandleAuthenticateAsync()
at Microsoft.AspNetCore.Authentication.AuthenticationHandler`1.AuthenticateAsync()
at Microsoft.AspNetCore.Authentication.AuthenticationService.AuthenticateAsync(HttpContext context, String scheme)
at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.Session.SessionMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.Session.SessionMiddleware.Invoke(HttpContext context)
at Kentico.Content.Web.Mvc.ContentOutputMiddleware.InvokeAsync(HttpContext context)
at Kentico.Web.Mvc.KenticoRequestLocalizationMiddleware.InvokeAsync(HttpContext context)
at Kentico.Content.Web.Mvc.PageRedirectionContextMiddleware.InvokeAsync(HttpContext context)
at Kentico.Web.Mvc.KenticoRequestEventsMiddleware.InvokeAsync(HttpContext context)
at Microsoft.AspNetCore.Session.SessionMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.Session.SessionMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.Diagnostics.StatusCodePagesMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware.g__Awaited|6_0(ExceptionHandlerMiddleware middleware, HttpContext context, Task task)

We are not using "X-Frame-Options" header on website. Could you please help me in solving this issue?

Thanks in advance, Krishna.

Correct Answer

Juraj Ondrus answered on September 30, 2022 09:25

Yes, I would just use Kentico 13 docs link and read the entire page - you will learn what a macro signature is and then you will understand what impact it has. But if you migrated the data, and you were not aware about the macro signatures, I guess the hash salt strings were not set to be the same and you have macro resolver errors in the Event log. In this case, re-signing macros is required or, you need to get the original hash salt string.

0 votesVote for this answer Unmark Correct answer

Recent Answers


Brenden Kehren answered on September 26, 2022 17:03

Make sure both the MVC site and Admin site are running on HTTPS.

0 votesVote for this answer Mark as a Correct answer

Srikrishna Podduturi answered on September 26, 2022 17:31

Both are running on https. Admin site is hosted inside the MVC site like https://www.mysite.com/admin. Page tab is loading in local but it is not in Dev and Live.

0 votesVote for this answer Mark as a Correct answer

Juraj Ondrus answered on September 27, 2022 07:30

Are the Presentation URL and administration URLs set correctly? What is the difference between local and DEV/Live? Is the SameSite mode set?
Also, how is this configured in the IIS? Is the admin app nested as a virtual app underneath the MVC app? If yes, this is not recommended. You should either run the apps in separate sites or separate virtual apps, not nesting them.

0 votesVote for this answer Mark as a Correct answer

Srikrishna Podduturi answered on September 29, 2022 12:22

Sorry for the late response. Dev & live have the same site mode but hosted on different servers. Admin app is added as an application inside the MVC site in IIS. I tried by adding admin as a separate site but still getting the same error.

0 votesVote for this answer Mark as a Correct answer

Juraj Ondrus answered on September 29, 2022 13:53

What is the hotfix applied to your projects? Does the hotfix version applied on admin app matches the version of the Kentico NuGet packages on the live site app? Please, check also the following:

Live site runs on HTTPS (the live site presentation URL uses HTTPS): it looks like your Live site already runs on HTTPS

SameSite mode is configured correctly

Browser does not block 3rd-party cookies

If you are using a self-signed certificate for the live site in the dev environment - you need to accept this certificate in your browser and reload the administration interface

0 votesVote for this answer Mark as a Correct answer

Srikrishna Podduturi answered on September 29, 2022 14:23

Thank you for quick reply. We have used 13.0.81 hotfix.

I will check your suggestions but before that I have observed that page tab is loading when impersonated with a valid user but it does not work with administrator login. We have migrated users from Kentico 12 to 13 using Kentico Xperience Import Toolkit 13. Do i need to make any changes to the Global administrator user settings in order for page tab to load?

0 votesVote for this answer Mark as a Correct answer

Juraj Ondrus answered on September 29, 2022 14:40

I would check that the privilege level is set correctly and maybe try setting new password through the UI.

0 votesVote for this answer Mark as a Correct answer

Srikrishna Podduturi answered on September 30, 2022 08:55

Thanks for advise. I have changed the privilege level to 'administrator' and it started working. Any idea why it is not working with 'Global administrator' privilege?

0 votesVote for this answer Mark as a Correct answer

Juraj Ondrus answered on September 30, 2022 08:58

There is something wrong with the user account. Maybe wrong macro signatures - have you tried resigning macros?

0 votesVote for this answer Mark as a Correct answer

Srikrishna Podduturi answered on September 30, 2022 09:22

No. Do i need to resign all macros as shown in this link - "https://docs.xperience.io/k11/macro-expressions/troubleshooting-macros/working-with-macro-signatures"? Does it have any affect on data/objects?

0 votesVote for this answer Mark as a Correct answer

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