Skip to content

Instantly share code, notes, and snippets.

@akshaysura
akshaysura / CatchErrorsRendererErrorStrategy.cs
Last active June 12, 2025 19:44
CatchErrorsRendererErrorStrategy
using System;
using System.IO;
using System.Web.Mvc;
using Microsoft.Extensions.DependencyInjection;
using Sitecore.Abstractions;
using Sitecore.DependencyInjection;
using Sitecore.Mvc.Pipelines.Response.RenderRendering;
using Sitecore.Mvc.Presentation;
using Sitecore;
using Sitecore.XA.Foundation.Multisite.Extensions;
@akshaysura
akshaysura / Patch.Config
Last active June 12, 2025 19:43
SxaPageModeRenderingErrorStrategy Patch
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
<sitecore>
<pipelines>
<mvc.renderRendering>
<processor type="Sitecore.Mvc.Pipelines.Response.RenderRendering.ExecuteRenderer, Sitecore.Mvc">
<param type="Sitecore.Mvc.Pipelines.Response.RenderRendering.HttpExceptionWrappingRendererErrorStrategy, Sitecore.Mvc" desc="rendererErrorHandler">
<param type="Sitecore.Mvc.Pipelines.Response.RenderRendering.ChainedRendererErrorStrategy, Sitecore.Mvc" desc="rendererErrorHandler">
<Handlers hint="list">
<handler patch:before="handler[@type='Sitecore.XA.Foundation.Presentation.Pipelines.RenderRendering.SxaPageModeRenderingErrorStrategy, Sitecore.XA.Foundation.Presentation']" type="SOMESOLUTION.SOMEPROJECT.PipelineHandlers.CatchErrorsRendererErrorStrategy, SOMESOLUTION.SOMEPROJECT.PipelineHandlers"/>
</Handlers>
@akshaysura
akshaysura / Install MongoDB 3.2.7 as a Windows Service using Windows PowerShell
Last active September 30, 2019 19:47
Use this PowerShell script to install MongoDB
$mongoDbPath = "$env:SystemDrive\MongoDB"
$mongoDbConfigPath = "$mongoDbPath\mongod.cfg"
$url = "https://fastdl.mongodb.org/win32/mongodb-win32-x86_64-2008plus-3.2.7.zip"
$zipFile = "$mongoDbPath\mongo.zip"
$unzippedFolderContent ="$mongoDbPath\mongodb-win32-x86_64-2008plus-3.2.7"
if ((Test-Path -path $mongoDbPath) -eq $True)
{
write-host "Seems you already installed MongoDB"
exit
@akshaysura
akshaysura / HabitatSolutionScript.ps1
Created January 21, 2017 23:34
Create a Sitecore Helix solution from scratch using PowerShell
#paths to the project templates on your system
$global:classTemplate = "D:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\ProjectTemplatesCache\CSharp\Windows Root\Windows\1033\ClassLibrary\csClassLibrary.vstemplate"
$global:webTemplate = "D:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\ProjectTemplatesCache\CSharp\Web\1033\WebApplicationProject40\EmptyWebApplicationProject40.vstemplate"
#variable used to store the path for the empty Habitat folder
$global:helixPath =""
#empty variable used to store the solution name
$global:solutionName = ""
@akshaysura
akshaysura / GetFromLayoutFieldWithSharedPlaceholders.cs
Last active September 4, 2017 16:18
Sitecore Multisite Shared Placeholders and Cascading.
using Sitecore;
using Sitecore.Data.Fields;
using Sitecore.Data.Items;
using Sitecore.Diagnostics;
using Sitecore.Mvc.Extensions;
using Sitecore.Mvc.Pipelines.Response.GetXmlBasedLayoutDefinition;
using Sitecore.Mvc.Presentation;
using System;
using System.Collections.Generic;
using System.Linq;