The patch:insteadpatch:instead
attribute is used to replace the existing Sitecore.MediaRequestHandlerSitecore.MediaRequestHandler
processor in the initialize pipeline with your custom handler.
Create a new patch file, for example, CustomMediaRequestHandler.config
CustomMediaRequestHandler.config
, in the App_Config/IncludeApp_Config/Include
folder.<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/"> <sitecore> <pipelines> <initialize> <processor type="example.example.example.Processors.CustomMediaRequestHandler, example.example.Redirects" patch:instead="processor[@type='Sitecore.Resources.Media.MediaRequestHandler, Sitecore.Kernel']"/> </initialize> </pipelines> </sitecore> </configuration>
2.If your handler configuration is under the section<handlers>
section, you can use the following XML structure:
<?xml version="1.0" encoding="utf-8"?>
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
<system.webServer>
<handlers>
<add verb="*" path="sitecore_media.ashx" type="example.example.example.Processors.CustomMediaRequestHandler, example.example.Redirects" name="Sitecore.MediaRequestHandler" patch:instead="add[@name='Sitecore.MediaRequestHandler']"/>
</handlers>
</system.webServer>
</configuration>
Hope this help!