Monday, 21 July 2014

ReferenceError: Sys is not defined while working in Sitecore Content Editor

Leave a Comment
Today I was working on clean installation of Sitecore CMS 7.0 rev. 130918 and configured it to support MVC. Somehow I started getting below error while working with rich text editor in Sitecore Content Editor.
Uncaught ReferenceError: Sys is not defined.

It seems that embedded scripts were not getting loaded by Webresource.axd and Scriptresource.axd handlers. While troubleshooting, I’ve checked for WebResource.axd in IgnoreUrlPrefixes setting to ensure that necessary javascripts are getting loaded. Below entry was present in web.config:
<setting name="IgnoreUrlPrefixes" value="/sitecore/default.aspx|/trace.axd|/webresource.axd|/sitecore/shell/Controls/Rich Text Editor/Telerik.Web.UI.DialogHandler.aspx|/sitecore/shell/applications/content manager/telerik.web.ui.dialoghandler.aspx|/sitecore/shell/Controls/Rich Text Editor/Telerik.Web.UI.SpellCheckHandler.axd|/Telerik.Web.UI.WebResource.axd|/sitecore/admin/upgrade/|/layouts/testing"/>
I’ve also added Scriptresource.axd in IgnoreUrlPrefixes settings but it didn’t work in my case then I started to check MVC routes. The routes for the MVC Web Application are defined in the RouteConfig.cs under the App_Start folder of the MVC Project. In static function RegisterRoutes(RouteCollection routes) below route was defined:
The route with the pattern {resource}.axd/{*pathInfo} was included to prevent requests for the web resource files such as WebResource.axd or ScriptResource.axd from being passed to a controller. I’ve deleted above route entry and build the solution. Bingo! I was no longer getting any error message. Please drop a comment if anybody knows more detail about this error and let me know your opinion.

Comments and suggestions are most welcome. Happy coding!


Post a Comment