I am trying to enable VisitorIdentification on our pages, so I have added @Html.Sitecore().VisitorIdentification() to our layout pages. However, when the page loads, it throws a 404 when trying to load VisistorIdentification.js found in /layouts/system/

The file exists, however when I try to browse to it directly, it also throws the file not found error page. If I put this file in the root /Scripts/ folder, it will load correctly.

The permissions are set so the site can access this folder, and it is using the layouts in the /layouts/ folder, as well as loading the VisitorIdentification.ascx in the /layouts/system folder, however it is not able to find the VisitorIdentification.js file.

This is the only thing that is found in the log file:

21492 12:09:40 ERROR Application error. Exception: System.Web.HttpException Message: Path '/layouts/system/VisitorIdentification.js' was not found. Source: System.Web at System.Web.HttpNotFoundHandler.ProcessRequest(HttpContext context) at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() at System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step) at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

  • Do you have any custom 404 handlers that maybe intercepting the request?
    – jammykam
    Mar 6, 2018 at 21:56
  • can you post the actual errors from the log ? Mar 6, 2018 at 22:37
  • We don't have any custom 404 handlers. I've added what I found in the log to the question
    – Bryan
    Mar 7, 2018 at 1:04
  • Does the VisitorIdentification.js presents at the path Website\layouts\System and also does the directory has enough read access? Mar 7, 2018 at 7:06
  • Can you try adding a .html or other common file type to /layouts/system and see if that file returns a 404 as well? Perhaps it's something specific to .js files in that folder?
    – Adam Weber
    Mar 7, 2018 at 14:33

1 Answer 1


Figured out the issue.

There was specific web.config in the layouts folder that was generated and had this line in it, which was blocking all files.

<add name="BlockViewHandler" path="*" verb="*" preCondition="integratedMode" type="System.Web.HttpNotFoundHandler" />

Updating this to only block cshtml and ascx files has fixed the issue

<add name="BlockViewHandler" path="*.cshtml,*.ascx" verb="*" preCondition="integratedMode" type="System.Web.HttpNotFoundHandler" />

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.