Monday, September 8, 2014

Issue with SEO Toolkit module and SBOS Accelerator Module running together

One of my recent investigations was about an issue caused by SBOS Accelerator module. After through investigation, it proved to be an issue caused by SEO Toolkit module. This post is about my findings.

Environment :

Sitecore 7.2 rev. 140526
Sitecore Search Engine Optimization -1.3.0 rev.130319
SBOS Accelerators Shared Source Module - 2.0 rev. 140422


Issue 1 : SEO Toolkit module issue
When we run the seo tool for a page, and then select the "Links" link in the results, it returns/displays the following error


















when "Links .." link selected,


Issue 2 : SBOS module issue

When we select the "Enable personalization tracking" checkbox and save, and then return to the same place again, checkbox was displayed unselected/unchecked




Investigation/Solution :

1. When check into the sitecore error logs, following error was found 

Error Logs Message I:

Exception: System.Web.HttpUnhandledException
Message: Exception of type 'System.Web.HttpUnhandledException' was thrown.
Source: System.Web
   at System.Web.UI.Page.HandleError(Exception e)
   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
   at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
   at System.Web.UI.Page.ProcessRequest()
   at System.Web.UI.Page.ProcessRequest(HttpContext context)
   at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
   at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

Nested Exception

Exception: System.Web.HttpException
Message: The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>).
Source: System.Web
   at System.Web.UI.ControlCollection.Add(Control child)
   at Sitecore.Layouts.PageContext.InsertSystemControls()
   at (Object , Object[] )
   at Sitecore.Pipelines.CorePipeline.Run(PipelineArgs args)
   at Sitecore.Layouts.PageContext.BuildControlTree(Object sender, EventArgs e)
   at System.Web.UI.Page.PerformPreInit()
   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

 
2. Checked our own control files. -> we could not find any place with <% .. %>
 3. Disabled SBOS Accelerators module (rename /App_Config/Include/Sitecore.SBOSAccelerators.config file to Sitecore.SBOSAccelerators.config.disabled)
 when clicked on the "Links" after running the SEO module, it again return the error.
4. But, this time, sitecore logs displayed a different error message
Error Logs Message II

Exception: System.Web.HttpRequestValidationException
Message: A potentially dangerous Request.Form value was detected from the client (<postData><links><link controlID=""a70"><![CDATA[http://chg....").
Source: System.Web
   at System.Web.HttpRequest.ValidateString(String value, String collectionKey, RequestValidationSource requestCollection)
   at System.Web.HttpRequest.ValidateHttpValueCollection(HttpValueCollection collection, RequestValidationSource requestCollection)
   at Sitecore.Pipelines.PreprocessRequest.SuppressFormValidation.Process(PreprocessRequestArgs args)
   at (Object , Object[] )
   at Sitecore.Pipelines.CorePipeline.Run(PipelineArgs args)
   at Sitecore.Nexus.Web.HttpModule. (Object , EventArgs )
   at System.Web.HttpApplication.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
   at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

6756 13:24:19 ERROR Application error.
Exception: System.Web.HttpRequestValidationException
Message: A potentially dangerous Request.Form value was detected from the client (<html id="...lang="en"><!--<![endif]--><hea...").
Source: System.Web
   at System.Web.HttpRequest.ValidateString(String value, String collectionKey, RequestValidationSource requestCollection)
   at System.Web.HttpRequest.ValidateHttpValueCollection(HttpValueCollection collection, RequestValidationSource requestCollection)
   at Sitecore.Pipelines.PreprocessRequest.SuppressFormValidation.Process(PreprocessRequestArgs args)
   at (Object , Object[] )
   at Sitecore.Pipelines.CorePipeline.Run(PipelineArgs args)
   at Sitecore.Nexus.Web.HttpModule. (Object , EventArgs )
   at System.Web.HttpApplication.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
   at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)


5. To solve this issue, we add the following property to <httpRuntime ..> tag in web.config
<httpRuntime maxRequestLength="512000" executionTimeout="600" enableKernelOutputCache="false" relaxedUrlToFileSystemMapping="true" requestValidationMode="2.0" />

6. Then, SEO Toolkit module start to work fine.
7. Re-enabled the SBOS Accelerators module (rename /App_Config/Include/Sitecore.SBOSAccelerators.config.disabled to Sitecore.SBOSAccelerators.config)
8. SEO toolkit module stopped working again with the Error Logs Message I
9. Then, I looked into the control files in SEO module. In those files I found the <% .. %> code part.
/seotoolkit/ui/Extender.ascx, /seotoolkit/ui/Keyword.ascx, /seotoolkit/ui/SearchEngine.ascx
Fortunately, those files did not have any code behind files. So, I create a seperate library project and moved the <% .. %> code parts into that project. Then, point the seotoolkit .ascx files codebehind to those library .cs files.
All the things start to work properly. (Including the issue 2 - "Enable personalization tracking" checkbox).
Hope this help..