3

I'm using Sitecore 9.0.2.

I am implementing a class to override Sitecore.Pipelines.PreprocessRequest.FilterUrlExtensions.

I wrote my patch config as such:

<?xml version="1.0" encoding="utf-8" ?>
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
  <sitecore>
    <pipelines>
      <initialize>
        <processor type="eSundhedWeb.Foundation.Permissions.Pipelines.CustomPreprocessor, eSundhedWeb.Foundation.Permissions" patch:instead="processor[@type='Sitecore.Pipelines.PreprocessRequest.FilterUrlExtensions, Sitecore.Kernel']">
          <param desc="Allowed extensions (comma separated)">aspx, ashx, asmx</param>
          <param desc="Blocked extensions (comma separated)">*</param>
          <param desc="Blocked extensions that stream files (comma separated)">*</param>
          <param desc="Blocked extensions that do not stream files (comma separated)"/>
        </processor>
      </initialize>
    </pipelines>
  </sitecore>
</configuration>

As I'm trying to run it I get the following exception:

Could not find method: Process. Pipeline: /sitecore[database="SqlServer" xmlns:patch="http://www.sitecore.net/xmlconfig/"]/pipelines/initialize/processor[type="eSundhedWeb.Foundation.Permissions.Pipelines.CustomPreprocessor, eSundhedWeb.Foundation.Permissions" patch:source="Foundation.Permissions.CustomPreprocessor.config"]

I've verified that my method signature matches the signature in FilterUrlExtensions as you can see here:

My class:

 public class CustomPreprocessor : Sitecore.Pipelines.PreprocessRequest.FilterUrlExtensions

    { 
        public CustomPreprocessor(string allowed, string blocked, string streamFiles, string doNotStreamFiles) : base(allowed, blocked, streamFiles, doNotStreamFiles)
        {
        }

        public override void Process(PreprocessRequestArgs args)
        {

            base.Process(args);
        }

    }

FilterUrlExtensions:

    public class FilterUrlExtensions : PreprocessRequestProcessor
    {
        public FilterUrlExtensions(string allowed, string blocked, string streamFiles, string doNotStreamFiles);

        public override void Process(PreprocessRequestArgs args);
    }

What might be causing this problem?

3

You implemented custom preprocessRequest processor but then you regisitered it in initialize pipeline.

Change your configuration to

<?xml version="1.0" encoding="utf-8" ?>
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
  <sitecore>
    <pipelines>
      <preprocessRequest>
        <processor type="eSundhedWeb.Foundation.Permissions.Pipelines.CustomPreprocessor, eSundhedWeb.Foundation.Permissions" patch:instead="processor[@type='Sitecore.Pipelines.PreprocessRequest.FilterUrlExtensions, Sitecore.Kernel']">
          <param desc="Allowed extensions (comma separated)">aspx, ashx, asmx</param>
          <param desc="Blocked extensions (comma separated)">*</param>
          <param desc="Blocked extensions that stream files (comma separated)">*</param>
          <param desc="Blocked extensions that do not stream files (comma separated)"/>
        </processor>
      </preprocessRequest>
    </pipelines>
  </sitecore>
</configuration>
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.