2

I started a new browser session, navigated straight to a page with a form on it, then left the page open for a few minutes, when I started filling the form I received a window alert with Your session has expired. Please refresh this page.

Why have I received this and why does the page need to be refreshed?

1 Answer 1

3

The form.tracking.js script that ships with Sitecore triggers a POST request on blur of a field if the field has changed. The server-side handler code then checks

if (HttpContext.Session.IsNewSession) { 
return content with "Your session has expired. Please refresh this page." 
}

the client-side js will then show that message as an alert.

The page likely will need to be refreshed because a new session has started, and therefore the CSRF token will be invalid and the user will get an error trying to submit the form.

In this case if you started a new browser session, the Sitecore robot detection needs to run. If it didn't classify you as human yet, then after some time the session will time out. The default timeout set on Analytics.Robots.SessionTimeout is 1 minute, so this fits the short time frame you're mentioning.

1
  • Is there any way to increase the timeout time or bypass this issue?.
    – Mamtha
    Commented Jan 14 at 19:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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