0

I'm getting HTTP Error 500.0 - Could not find type 'GeoIP.GeoIPInformation.ExampleContextExtension,GeoIP' for below piece of code and patch file.

can anyone help on this please.

Code:

namespace GeoIP
{
    public class GeoIPInformation
    {
        public class ExampleContextExtension : Sitecore.JavaScriptServices.ViewEngine.LayoutService.Pipelines.GetLayoutServiceContext.JssGetLayoutServiceContextProcessor
        {
            public ExampleContextExtension(IConfigurationResolver configurationResolver) : base(configurationResolver)
            {
            }

            protected override void DoProcess(GetLayoutServiceContextArgs args, AppConfiguration application)
            {
                //var w = Sitecore.CES.GeoIp.Core.Lookups.LookupManager.GetWhoIsInformationByIp("193.200.33.51");

                args.ContextData.Add("securityInfo", new
                {
                    isAnonymous = !Sitecore.Context.User.IsAuthenticated

                });
                //args.ContextData.Add("GeoIPInfo", new
                //{
                //    // isAnonymous = !Sitecore.Context.User.IsAuthenticated,
                //    GeoIPInfo = w.ToString()
                //});
            }
        }
    }
}

Patch file:

<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
  <sitecore>
    <pipelines>
      <group groupName="layoutService">
        <pipelines>
          <getLayoutServiceContext>
            <processor type="GeoIP.GeoIPInformation.ExampleContextExtension,GeoIP" resolve="true" />
          </getLayoutServiceContext>
        </pipelines>
      </group>
    </pipelines>
  </sitecore>
</configuration>

enter image description here

  • Could you please add a screenshot of the browser console detailing the error? – Abhay Dhar Oct 30 at 12:16
  • And the project information that the above code snippet sits in – Mark Cassidy Oct 30 at 12:17
  • I have added screenshot for the error. we need to add GeoIP information in JSON data using sitecore JSS. – Erwin Paul Oct 30 at 14:00
  • Should the ExampleContextExtension class inherit from Sitecore.LayoutService.ItemRendering.Pipelines.GetLayoutServiceContext.IGetLayoutServiceContextProcessor ? – Abhay Dhar Oct 31 at 10:30
  • when I removed this class "public class GeoIPInformation" and updated patch config accordingly then it started working. thanks. – Erwin Paul Oct 31 at 12:24

Your Answer

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

Browse other questions tagged or ask your own question.