Close Menu
    DevStackTipsDevStackTips
    • Home
    • News & Updates
      1. Tech & Work
      2. View All

      Sunshine And March Vibes (2025 Wallpapers Edition)

      May 16, 2025

      The Case For Minimal WordPress Setups: A Contrarian View On Theme Frameworks

      May 16, 2025

      How To Fix Largest Contentful Paint Issues With Subpart Analysis

      May 16, 2025

      How To Prevent WordPress SQL Injection Attacks

      May 16, 2025

      Microsoft has closed its “Experience Center” store in Sydney, Australia — as it ramps up a continued digital growth campaign

      May 16, 2025

      Bing Search APIs to be “decommissioned completely” as Microsoft urges developers to use its Azure agentic AI alternative

      May 16, 2025

      Microsoft might kill the Surface Laptop Studio as production is quietly halted

      May 16, 2025

      Minecraft licensing robbed us of this controversial NFL schedule release video

      May 16, 2025
    • Development
      1. Algorithms & Data Structures
      2. Artificial Intelligence
      3. Back-End Development
      4. Databases
      5. Front-End Development
      6. Libraries & Frameworks
      7. Machine Learning
      8. Security
      9. Software Engineering
      10. Tools & IDEs
      11. Web Design
      12. Web Development
      13. Web Security
      14. Programming Languages
        • PHP
        • JavaScript
      Featured

      The power of generators

      May 16, 2025
      Recent

      The power of generators

      May 16, 2025

      Simplify Factory Associations with Laravel’s UseFactory Attribute

      May 16, 2025

      This Week in Laravel: React Native, PhpStorm Junie, and more

      May 16, 2025
    • Operating Systems
      1. Windows
      2. Linux
      3. macOS
      Featured

      Microsoft has closed its “Experience Center” store in Sydney, Australia — as it ramps up a continued digital growth campaign

      May 16, 2025
      Recent

      Microsoft has closed its “Experience Center” store in Sydney, Australia — as it ramps up a continued digital growth campaign

      May 16, 2025

      Bing Search APIs to be “decommissioned completely” as Microsoft urges developers to use its Azure agentic AI alternative

      May 16, 2025

      Microsoft might kill the Surface Laptop Studio as production is quietly halted

      May 16, 2025
    • Learning Resources
      • Books
      • Cheatsheets
      • Tutorials & Guides
    Home»Development»Handling Not Allowed Reflection Method in Sitecore

    Handling Not Allowed Reflection Method in Sitecore

    May 9, 2024

    Recently, to meet project requirements, we customized and expanded the functionality of the “General Link” feature by incorporating a new “Telephone Link” feature. Everything was working correctly on our local project instance, but we got the below-listed error when the changes were deployed on the higher environment.

    Exception: Sitecore.Exceptions.AccessDeniedException
    Message: Calling Fieldtypes.ExtendedGeneralLink.ExtendedGeneralLinkForm.OnModeChange method through reflection is not allowed.
    Source: Sitecore.Kernel
    at Sitecore.Reflection.MethodFilter.Filter[T](MethodInfo method)
    at Sitecore.Shell.Framework.Commands.CommandManager.GetMethodCommand(String command)
    at Sitecore.Web.UI.Sheer.ClientPage.Dispatch(String command)
    at Sitecore.Web.UI.Sheer.ClientPage.RaiseEvent()
    at Sitecore.Web.UI.Sheer.ClientPage.OnPreRender(EventArgs e)
    at System.Web.UI.Control.PreRenderRecursiveInternal()
    at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

    Solutions: Handling Not Allowed Reflection Method in Sitecore

    I looked into the problem and discovered the solution provided by Himmat Singh Dulawat in this article. Since it was my first time implementing these required patch solutions, I wasn’t familiar with the proper patch file hierarchy or the pattern that needed to be added correctly. Below is the necessary configuration structure for adding the patch file.

    <?xml version=”1.0″ encoding=”utf-8″ ?>
    <configuration xmlns:role=”http://www.sitecore.net/xmlconfig/role/” xmlns:security=”http://www.sitecore.net/xmlconfig/security/” xmlns:patch=”http://www.sitecore.net/xmlconfig/”>
    <sitecore>
    <reflection>
    <allowedMethods>
    <!–For example: <descriptor type=”SampleNameSpace.MyClass” methodName=”MyMethod” assemblyName=”MyAssembly”/> –>
    <!–Allowed Methods–>
    <descriptor type=”Fieldtypes.ExtendedGeneralLink.ExtendedGeneralLinkForm” hint=”ExtendedGeneralLinkForm.OnModeChange” methodName=”OnModeChange” assemblyName=”Fieldtypes”/>
    </allowedMethods>
    <allowedPatterns>
    <!–Default–>
    <pattern value=”^Sitecore..*,Sitecore..*$”/>
    <!–Add additional allowed method patterns–>
    <pattern value=”^Fieldtypes..*,Fieldtypes..*$”/>
    </allowedPatterns>
    </reflection>
    </sitecore>
    </configuration>

    In our situation, we encountered an issue where multiple “allowedMethods” were present, and we added all the methods in the patch file. However, after deployment and verifying it using the showconfig file, only the last method was added within the allowedMethods.

    Upon reviewing the patch files, we realized that since all the “allowedMethods” belonged to the same class and we were not using the “hint” attribute, it took only the last method. Once we added the “hint” attribute, our issue was resolved.

    Click the “GitHub – Reflection Filtering Patch” link to access the detailed configuration needed to resolve the reflection issue.

    The GitHub config file changes were initially implemented for the “Extending General Link for Experience Editor” enhancements. Everything was functioning correctly, along with additional patch file configurations for reflections. However, after thorough testing, we decided to optimize our code and reduce the number of allowedMethods.

    Therefore, we introduced the “Extending General Link for Experience Editor Alternate Approach.” This new approach reduced the allowedMethods configuration from 7 to 1. The optimized allowedMethods code according to our alternate approach is displayed below.

    <?xml version=”1.0″ encoding=”utf-8″ ?>
    <configuration xmlns:role=”http://www.sitecore.net/xmlconfig/role/” xmlns:security=”http://www.sitecore.net/xmlconfig/security/” xmlns:patch=”http://www.sitecore.net/xmlconfig/”>
    <sitecore>
    <reflection>
    <allowedMethods>
    <descriptor type=”Fieldtypes.ExtendedGeneralLink.ExtendedGeneralLinkForm” hint=”ExtendedGeneralLinkForm.OnModeChange” methodName=”OnModeChange” assemblyName=”Fieldtypes”/>
    </allowedMethods>
    <allowedPatterns>
    <pattern value=”^Fieldtypes..*,Fieldtypes..*$”/>
    </allowedPatterns>
    </reflection>
    </sitecore>
    </configuration>

    Conclusion

    We addressed the “Reflection Method” error by configuring the patch file hierarchy and implementing the proper method pattern. This ensured smooth functionality in our project. Additionally, we optimized our code by reducing the number of allowed methods following an alternate approach outlined in the “Extending General Link for Experience Editor Alternate Approach” enhancements. This streamlined our codebase, enhancing efficiency and reliability.

    Hope this helps. Happy learning!

    Source: Read More 

    Facebook Twitter Reddit Email Copy Link
    Previous ArticleGoogle Brings Gemini AI to Cybersecurity
    Next Article An easy way to experiment with signals

    Related Posts

    Security

    Nmap 7.96 Launches with Lightning-Fast DNS and 612 Scripts

    May 17, 2025
    Common Vulnerabilities and Exposures (CVEs)

    CVE-2024-47893 – VMware GPU Firmware Memory Disclosure

    May 17, 2025
    Leave A Reply Cancel Reply

    Continue Reading

    OpenDevin: An Artificial Intelligence Platform for the Development of Powerful AI Agents that Interact in Similar Ways to Those of a Human Developer

    Development

    New Investment Scam Leverages AI, Social Media Ads to Target Victims Worldwide

    Development

    CVE-2025-24223 – Apple Safari Web Content Memory Corruption Vulnerability

    Common Vulnerabilities and Exposures (CVEs)

    Avoiding Metadata Contention in Unity Catalog

    Development

    Highlights

    Development

    Meet Inspect: The Latest AI Safety Evaluations Platform Introduced By UK’s AI Safety Institute 

    May 15, 2024

    Recently, the UK government-backed AI Safety Institute has introduced Inspect, an Artificial Intelligence (AI) safety…

    Georgia Tech and Stanford Researchers Introduce MLE-Dojo: A Gym-Style Framework Designed for Training, Evaluating, and Benchmarking Autonomous Machine Learning Engineering (MLE) Agents

    May 15, 2025

    Researcher Uncovers Exploited Flaw in Cox Modems That May Have Impacted Millions of Customers

    June 3, 2024

    CVE-2025-46585 – Linux Kernel Out-of-bounds Array Read/Write Vulnerability

    May 6, 2025
    © DevStackTips 2025. All rights reserved.
    • Contact
    • Privacy Policy

    Type above and press Enter to search. Press Esc to cancel.