Thursday, September 5, 2019

Sitecore 9 Identity Server Error With CA SSL Certificates

One of the implementations I did recently is a Sitecore 9.1 installation/upgrade.

Initially we had the Sitecore Identity server IIS site running using a Self-Signed certificate and I adjusted it to be using CA signed SSL certificate.

That was done by importing that certs .pfx file into Trusted Root Certificate section of the Local Computer cert store, using MMC.
Then adjusted the Sitecore Identity server settings and Sitecore instance setting to match that certificate location & its certificate key. Also adjusted IIS site instance to use this newly imported certificate.

Once the above is done, we started to face issues with Sitecore logins. We were not able to get the Sitecore login working with Identity Server instance returning 500 error message.

[FTL] (Sitecore STS/auenws-sccm-w01) Unhandled exception: "Keyset does not exist"
Internal.Cryptography.CryptoThrowHelper+WindowsCryptographicException: Keyset does not exist
   at Internal.NativeCrypto.CapiHelper.CreateProvHandle(CspParameters parameters, Boolean randomKeyContainer)
   at System.Security.Cryptography.RSACryptoServiceProvider.get_SafeProvHandle()
   at System.Security.Cryptography.RSACryptoServiceProvider.get_SafeKeyHandle()
   at System.Security.Cryptography.RSACryptoServiceProvider..ctor(Int32 keySize, CspParameters parameters, Boolean useDefaultKeySize)
   at System.Security.Cryptography.RSACryptoServiceProvider..ctor(CspParameters parameters)
   at Internal.Cryptography.Pal.CertificatePal.<>c.<GetRSAPrivateKey>b__61_0(CspParameters csp)
   at Internal.Cryptography.Pal.CertificatePal.GetPrivateKey[T](Func`2 createCsp, Func`2 createCng)
   at Internal.Cryptography.Pal.CertificatePal.GetRSAPrivateKey()
   at Internal.Cryptography.Pal.CertificateExtensionsCommon.GetPrivateKey[T](X509Certificate2 certificate, Predicate`1 matchesConstraints)
   at Microsoft.IdentityModel.Tokens.X509SecurityKey.get_PrivateKey()
   at Microsoft.IdentityModel.Tokens.X509SecurityKey.get_PrivateKeyStatus()
   at Microsoft.IdentityModel.Tokens.AsymmetricSignatureProvider..ctor(SecurityKey key, String algorithm, Boolean willCreateSignatures)
   at Microsoft.IdentityModel.Tokens.CryptoProviderFactory.CreateSignatureProvider(SecurityKey key, String algorithm, Boolean willCreateSignatures)
   at System.IdentityModel.Tokens.Jwt.JwtSecurityTokenHandler.CreateEncodedSignature(String input, SigningCredentials signingCredentials)
   at System.IdentityModel.Tokens.Jwt.JwtSecurityTokenHandler.WriteToken(SecurityToken token)
   at IdentityServer4.Services.DefaultTokenCreationService.CreateJwtAsync(JwtSecurityToken jwt)
   at IdentityServer4.Services.DefaultTokenCreationService.CreateTokenAsync(Token token)
   at IdentityServer4.Services.DefaultTokenService.CreateSecurityTokenAsync(Token token)
   at IdentityServer4.ResponseHandling.AuthorizeResponseGenerator.CreateImplicitFlowResponseAsync(ValidatedAuthorizeRequest request, String authorizationCode)
   at ......

Then what I did was searching the internet for the above error message.

The solution that was provided by the to people was to set the permission on the imported certificate for the IIS app user account.

To achieve that, we need to be able to access the "All Tasks -> Manage Private Keys..." option for that certificate.




But that option was not available when the certificate is on the "Trusted Root Certification Authorities" OR "Intermediate Certification Authorities". But that option is only available for certificates on "Personal" certificate store.

So what I did was,
1) I moved our imported certificate from "Trusted Root Certification Authories" store to "Personal" store.
2) Then set the permission for "IIS_IUSRS" user for that certificate using "Manage Private Keys..." option.
3) Then moved back the certificate again to "Trusted Root Certification Authorities" store.

(info on https://stackoverflow.com/questions/12106011/system-security-cryptography-cryptographicexception-keyset-does-not-exist)

This solved the issues with the Sitecore login.

Happy Sitecore!!


Monday, July 29, 2019

Glass Mapper StackOverflow Memory exception with InferType property set to Disable Lazy Loading

Recently we upgraded one of our solutions to Sitecore 9.1 and Glass Mapper 5.

After the upgrade, with some custom code also added, we started to get an issue with the Glass Mapper implemented solution, where the front-end website just throw an error and just dies. We were able to login to Backend Sitecore without any issues.

Following popup message is the only thing we get and site just throw this error continuously until we do an IIS reset.

Front-End Website Error Popup



There were nothing in the Sitecore Logs too related to this error.

But we could see following error on Windows event logs, which does not provide any useful information.

Faulting application name: w3wp.exe, version: 10.0.17134.1, time stamp: 0xed729d4eFaulting module name: clr.dll, version: 4.7.3416.0, time stamp: 0x5cabfc63Exception code: 0xc00000fdFault offset: 0x00000000000f503fFaulting process ID: 0x35b4Faulting application start time: 0x01d53db16c6f9a75Faulting application path: c:\windows\system32\inetsrv\w3wp.exeFaulting module path: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\clr.dllReport ID: a175fc77-b1fd-4370-bee8-f2dd927f34daFaulting package full name:


So, we go a memory dump and was able to see following error was thrown with StackOverflow exception. This below error was throwing over and over again.
.........Glass.Mapper.Sc.SitecoreService.RunCreateType(Sitecore.Data.Items.Item, Glass.Mapper.GetOptions, System.Collections.Generic.Dictionary`2<System.String, System.Object>)Glass.Mapper.Sc.LazyItemEnumerable`1[[System.__Canon, mscorlib]].ProcessItems()mscorlib_ni!System.Lazy`1[System.__Canon].CreateValue()$##6000F19+ecmscorlib_ni!System.Lazy`1[System.__Canon].LazyInitValue()$##6000F18+b8Glass.Mapper.Sc.LazyItemEnumerable`1[[System.__Canon, mscorlib]]..ctor(Glass.Mapper.Sc.GetItemsOptions, Glass.Mapper.Sc.ISitecoreService, Glass.Mapper.LazyLoadingHelper)DynamicClass.lambda_method(System.Runtime.CompilerServices.Closure, System.Object[])Glass.Mapper.Utilities.CreateGenericType(System.Type, System.Type[], System.Object[])Glass.Mapper.Sc.SitecoreService.GetItems(Glass.Mapper.Sc.GetItemsOptions)Glass.Mapper.AbstractDataMapper.MapCmsToProperty(Glass.Mapper.AbstractDataMappingContext)Glass.Mapper.Configuration.AbstractTypeConfiguration.MapPropertiesToObject(System.Object, Glass.Mapper.IAbstractService, Glass.Mapper.AbstractTypeCreationContext)Glass.Mapper.Pipelines.ObjectConstruction.Tasks.CreateConcrete.CreateConcreteTask.CreateObjectAndMapProperties(Glass.Mapper.Pipelines.ObjectConstruction.ObjectConstructionArgs)Glass.Mapper.Pipelines.ObjectConstruction.Tasks.CreateConcrete.CreateConcreteTask.Execute(Glass.Mapper.Pipelines.ObjectConstruction.ObjectConstructionArgs)Glass.Mapper.Pipelines.AbstractPipelineTask`1[[System.__Canon, mscorlib]].Next(System.__Canon)Glass.Mapper.Sc.Pipelines.ObjectConstruction.EnforcedTemplateCheck.PerformTemplateCheck(Glass.Mapper.Pipelines.ObjectConstruction.ObjectConstructionArgs, Sitecore.Data.ID, Glass.Mapper.Sc.Configuration.SitecoreEnforceTemplate)Glass.Mapper.Pipelines.AbstractPipelineTask`1[[System.__Canon, mscorlib]].Next(System.__Canon)Glass.Mapper.Pipelines.ObjectConstruction.Tasks.CacheCheck.CacheCheckTask.Execute(Glass.Mapper.Pipelines.ObjectConstruction.ObjectConstructionArgs)Glass.Mapper.Pipelines.AbstractPipelineTask`1[[System.__Canon, mscorlib]].Next(System.__Canon)Glass.Mapper.Sc.Pipelines.ObjectConstruction.SitecoreItemTask.Execute(Glass.Mapper.Pipelines.ObjectConstruction.ObjectConstructionArgs)Glass.Mapper.Pipelines.AbstractPipelineTask`1[[System.__Canon, mscorlib]].Next(System.__Canon)Glass.Mapper.Pipelines.AbstractPipelineTask`1[[System.__Canon, mscorlib]].Next(System.__Canon)Glass.Mapper.Sc.Pipelines.ObjectConstruction.NullItemTask.Execute(Glass.Mapper.Pipelines.ObjectConstruction.ObjectConstructionArgs)Glass.Mapper.Pipelines.AbstractPipelineRunner`2[[System.__Canon, mscorlib], [System.__Canon, mscorlib]].Run(System.__Canon)Glass.Mapper.AbstractService.InstantiateObject(Glass.Mapper.AbstractTypeCreationContext)Glass.Mapper.Sc.SitecoreService.RunCreateType(Sitecore.Data.Items.Item, Glass.Mapper.GetOptions, System.Collections.Generic.Dictionary`2<System.String, System.Object>)Glass.Mapper.AbstractDataMapper.MapCmsToProperty(Glass.Mapper.AbstractDataMappingContext)Glass.Mapper.Configuration.AbstractTypeConfiguration.MapPropertiesToObject(System.Object, Glass.Mapper.IAbstractService, Glass.Mapper.AbstractTypeCreationContext)Glass.Mapper.Pipelines.ObjectConstruction.Tasks.CreateConcrete.CreateConcreteTask.CreateObjectAndMapProperties(Glass.Mapper.Pipelines.ObjectConstruction.ObjectConstructionArgs)Glass.Mapper.Pipelines.ObjectConstruction.Tasks.CreateConcrete.CreateConcreteTask.Execute(Glass.Mapper.Pipelines.ObjectConstruction.ObjectConstructionArgs)Glass.Mapper.Pipelines.AbstractPipelineTask`1[[System.__Canon, mscorlib]].Next(System.__Canon)Glass.Mapper.Sc.Pipelines.ObjectConstruction.EnforcedTemplateCheck.PerformTemplateCheck(Glass.Mapper.Pipelines.ObjectConstruction.ObjectConstructionArgs, Sitecore.Data.ID, Glass.Mapper.Sc.Configuration.SitecoreEnforceTemplate)Glass.Mapper.Pipelines.AbstractPipelineTask`1[[System.__Canon, mscorlib]].Next(System.__Canon)Glass.Mapper.Pipelines.ObjectConstruction.Tasks.CacheCheck.CacheCheckTask.Execute(Glass.Mapper.Pipelines.ObjectConstruction.ObjectConstructionArgs)Glass.Mapper.Pipelines.AbstractPipelineTask`1[[System.__Canon, mscorlib]].Next(System.__Canon)Glass.Mapper.Sc.Pipelines.ObjectConstruction.SitecoreItemTask.Execute(Glass.Mapper.Pipelines.ObjectConstruction.ObjectConstructionArgs)Glass.Mapper.Pipelines.AbstractPipelineTask`1[[System.__Canon, mscorlib]].Next(System.__Canon)Glass.Mapper.Pipelines.AbstractPipelineTask`1[[System.__Canon, mscorlib]].Next(System.__Canon)Glass.Mapper.Sc.Pipelines.ObjectConstruction.NullItemTask.Execute(Glass.Mapper.Pipelines.ObjectConstruction.ObjectConstructionArgs)Glass.Mapper.Pipelines.AbstractPipelineRunner`2[[System.__Canon, mscorlib], [System.__Canon, mscorlib]].Run(System.__Canon)Glass.Mapper.AbstractService.InstantiateObject(Glass.Mapper.AbstractTypeCreationContext)Glass.Mapper.Sc.SitecoreService.RunCreateType(Sitecore.Data.Items.Item, Glass.Mapper.GetOptions, System.Collections.Generic.Dictionary`2<System.String, System.Object>)Glass.Mapper.Sc.SitecoreService.GetItem[[System.__Canon, mscorlib]](Glass.Mapper.Sc.GetItemOptions) ................

After few days of investigation, we were lucky enough to see some code part in our solution that might caused this. It was actually a LazyLoad setting setup for InferType properties in the base Glass model. From our code, we have disabled LazyLoading for InterType which caused the Glass Mapper to load all the parent/children items for Parents/Children InferType property defined in the Glass Base mode.

public GetItemByIdOptions CreateGetItemByIdOptions(Guid id) => new GetItemByIdOptions(id) { InferType = true, Lazy = Glass.Mapper.LazyLoading.Disabled };

Once we adjusted that "Lazy" setting to "Enabled" (see below), site starts to load without any issue again.


public GetItemByIdOptions CreateGetItemByIdOptions(Guid id) => new GetItemByIdOptions(id) { InferType = true, Lazy = Glass.Mapper.LazyLoading.Enabled };

Special thanks for Kamruz Jaman & Mike Renolds in Sitecore community to helping out with this issue with suggestions and time.


Hope this will help someone.. :-)


References :
This should be another reason for your Sitecore 9 site not loading - https://medium.com/@markgibbons25/sitecore-crashing-on-startup-with-internal-error-in-the-net-runtime-be5831e94b6e


Happy Sitecore!!!















Saturday, July 6, 2019

Sitecore User Group Conference - India - 2019

SUGCON India was held for the second consecutive year in this year (2019) at Bengaluru, India. This years event was held at ITC Gardenia hotel, Bengaluru and was a success with more than 200 participated.




I had the opportunity to conduct the Sitecore JSS workshop at the Sitecore User Group Conference India 2019. 30 people participated for this JSS workshop organized by Sitecore as pre-event classroom training. Special thanks to Pieter Brinkman & Rob Earlam from Sitecore for giving me the opportunity to conduct this JSS workshop on behalf of Sitecore. I hope participants walk away with good understanding of Sitecore JSS.




Also I had the opportunity of presenting my findings & experience on Sitecore SXA. Topic of the talk was "Accelerate your Sitecore website delivery with Sitecore SXA" and hope participants got motivation after seeing the website time-to-deliver got reduced dramatically using Sitecore SXA.


Presentation Slides : https://www.slideshare.net/chaturangaranatunga/accelerate-your-sitecore-website-delivery-with-sitecore-sxa-sugcon-india-2019
Presentation Recording : https://www.youtube.com/watch?v=D9oGYdANBN4&list=PLFwvXROgXsHMcp3KWefRIQSQMdTn0YIe0&index=27&t=0s


During the award ceremony held at the conclusion of the event, I receive my Sitecore Technology MVP 2019 award from Pieter Brinkman (Senior Director - Sitecore Technical Marketing). I thank Sitecore & Sitecore Technocal Marketing Team for the continuous help/encouragement provided for the community.

This is my 4th consecutive Sitecore Technology MVP award starting from year 2016.

Photo Credit : SUGCON India 2019 Website


I was interviewed by Sitecore for a Media bites session and following is its recording.



Overall it was a great event with meeting lots of community friends and lots and lots of knowledge sharing.

Hoping to see you all in next year's SUGCON India.



References:

SUGCON India Website : https://www.sugcon.in/
My Media bites interview : https://www.youtube.com/watch?v=lJFujE3J-RA&list=PLFwvXROgXsHM7Kh_64DSS_CXHOEka_Pb1&index=10
All the presentations slides : https://www.sugcon.in/2019-home/session-slides/
All the presentations recordings : https://www.youtube.com/playlist?list=PLFwvXROgXsHMcp3KWefRIQSQMdTn0YIe0
All the media from the event : https://www.sugcon.in/2019-home/media/





Wednesday, May 22, 2019

Make Sitecore SXA Sitemap Generation Respect SiteLanguages Setting

Recently we faced an issue where Sitecore SXA Sitemap is not respecting the Languages selected from the "Site Languages" field in site settings item.


For example, say you have a SXA site with "en-GB" selected as the Site Language in the settings. (see image below).



But  if an item have "en" language item also, generated sitemap will contain "hreflang" entries for both "en-GB" and "en" languages. (see image below)



So I decoded the Sitecore.XA.Feature.SiteMetadata.dll and in the "BuildMultilanguageSitemap" method, it's taking all the languages of the item and adding "hreflang" for each of those languages.
As you can see in the below image, it doesn't consider "Site Languages" setting set in the "Settings" item.




public class SitemapGenerator : Sitecore.XA.Feature.SiteMetadata.Sitemap.SitemapGenerator
{
    {
        private _MultiLanguageSettings _multiLanguageSettings;

        public SitemapGenerator() : base()
        {
            _multiLanguageSettings = ServiceLocator.ServiceProvider.GetService<IMultiLanguageRepository>().GetMultiLanguageSettings(Sitecore.Context.Site);
        }

        protected override StringBuilder BuildMultilanguageSitemap(IEnumerable<Item> childrenTree, SitemapLinkOptions options)
        {
            UrlOptions urlOptions = this.GetUrlOptions();
            SitemapLinkOptions options1 = new SitemapLinkOptions(options.Scheme, urlOptions, options.TargetHostname);
            List<XElement> xelementList1 = new List<XElement>();
            StringBuilder stringBuilder = new StringBuilder();

            if (_multiLanguageSettings == null || _multiLanguageSettings.SiteLanguages == null || !_multiLanguageSettings.SiteLanguages.Any())
            {
                return stringBuilder;
            }

            foreach (Item item in childrenTree)
            {
                SitemapChangeFrequency sitemapChangeFrequency = item.Fields[Sitecore.XA.Feature.SiteMetadata.Templates.Sitemap._Sitemap.Fields.ChangeFrequency].ToEnum<SitemapChangeFrequency>();

                if (sitemapChangeFrequency != SitemapChangeFrequency.DoNotInclude)
                {
                    List<XElement> xelementList2 = new List<XElement>();

                    foreach (Language language in item.Languages)
                    {
                        if (!_multiLanguageSettings.SiteLanguages.Any(l => l.Name.Equals(language.Name, StringComparison.InvariantCultureIgnoreCase)))
                        {
                            continue;
                        }

                        Item langItem = item.Database.GetItem(item.ID, language);
                        if (langItem.Versions.Count > 0)
                        {
                            options1.UrlOptions.Language = language;
                            XElement xelement = this.BuildAlternateLinkElement(this.GetFullLink(langItem, options1), language.CultureInfo.Name, "alternate");
                            xelementList2.Add(xelement);
                        }
                    }

                    options1.UrlOptions.Language = item.Language;
                    XElement xelement1 = this.BuildPageElement(this.GetFullLink(item, options1), this.GetUpdatedDate(item), sitemapChangeFrequency.ToString().ToLower(), this.GetPriority(item), (IEnumerable<XElement>)xelementList2);
                    xelementList1.Add(xelement1);
                }
            }

            XDocument xdocument = this.BuildXmlDocument((IEnumerable<XElement>)xelementList1);

            using (TextWriter textWriter = (TextWriter)new StringWriter(stringBuilder))
            {
                xdocument.Save(textWriter);
            }

            this.FixDeclaration(stringBuilder);
            return stringBuilder;
        }
}


Hope this helps !!!

Wednesday, February 6, 2019

I’m Happy to Announce That I’ve Been Named a Sitecore Most Valuable Professional for 2019!




Sitecore®, the global leader in digital experience management software, recently announced the 2019 group of Sitecore Most Valuable Professionals (MVPs) and, for the 4th consecutive year, I’ve been recognized as an MVP in the Technology category. The Sitecore MVP award is an elite distinction given for exceptional contributions to the Sitecore community and I’m honored to be one of only 186 Technology MVPs worldwide this year—not to mention the only person from Sri Lanka to be named a Sitecore MVP in 2019.  




Now it its 13th year, Sitecore’s MVP program recognized a total of 315 exceptional professionals from the Sitecore community of more than 12,000 certified developers and more than 20,000 active community participants. Sitecore MVPs are awarded for the quality, quantity, and level of impact of the contributions they make by sharing their product expertise and mastery of the Sitecore platform with other Sitecore partners and customers. 

As a Sitecore Freelance Consultant with more than 9 years of Sitecore development experience and overall 11 years in the software industry, I’ve thoroughly enjoyed sharing my expertise of Sitecore products, including on this blog and through the Sitecore User Group Sri Lanka (SUGSL – http://www.meetup.com/sugsrilanka - until Mid 2018), which I co-founded.

According to Pieter Brinkman, senior director of Technical Marketing at Sitecore: “The Sitecore community is renown as a place where members can easily collaborate and benefit from the vision and technical knowledge of one another. Within this community, MVPs set the standard of excellence for product expertise, enthusiasm, and willingness to donate time and energy to help customers and partners realize the full power of the Sitecore platform. Their passion is instrumental to the ongoing success of the Sitecore ecosystem.”

The Sitecore Experience Platform™ combines web content management, omnichannel digital delivery, insights into customer activity and engagement, and strategic digital marketing tools into a single, unified platform. Sitecore Experience Commerce™ natively integrates content and commerce so brands can fully personalize and individualize the end-to-end shopping experience before, during, and after the transaction. Both platforms capture in real time every minute interaction—and intention—that customers and prospects have with a brand across digital and offline channels. The result is that Sitecore customers are able to use the platform to engage with prospects and customers in a highly personalized manner, earning long-term customer loyalty.


More information can be found about the MVP Program on the Sitecore MVP site: http://mvp.sitecore.com.

Wednesday, December 19, 2018

Passing Context Item Information as hidden field values with Sitecore 9 Forms

Recently I was working with Sitecore Forms in Sitecore 9 installation and needed to pass context item information (Item Name, Item ID) where a given form is implemented.

After investigating, there were no default way/field to achieve this and had to implement custom field type for that.

Following is the code implementation to get the hidden field and to populate the hidden field.

public class FormDataSubmitAction : SubmitActionBase<string>
{
        public FormDataSubmitAction(ISubmitActionData submitActionData) : base(submitActionData)
        {
        }
        protected override bool Execute(string data, FormSubmitContext formSubmitContext)
        {
            Assert.ArgumentNotNull(formSubmitContext, nameof(formSubmitContext));
          
            if (!formSubmitContext.HasErrors)
            {
                StringBuilder message = new StringBuilder();
                var parameters = new NameValueCollection();
              
                foreach (IViewModel field in formSubmitContext.Fields)
                {
                    if(field.FieldTypeItemId.Equals(<CustomHiddenFieldTemplateID>, StringComparison.InvariantCultureIgnoreCase))
                    {
                        AddExtraAttributes(parameters, GetValue(field));
                        continue;
                    }
                    parameters.Add(field.Name, GetValue(field));
                }
                PostData(parameters);
            }
            else
            {
                Logger.Warn(Invariant($"Form {formSubmitContext.FormId} submitted with errors: {string.Join(", ", formSubmitContext.Errors.Select(t => t.ErrorMessage))}."), this);
            }
            return true;
        }
      
        protected override bool TryParse(string value, out string target)
        {
            target = string.Empty;
            return true;
        }
        protected virtual NameValueCollection AddExtraAttributes(NameValueCollection parameters, string contextItemId)
        {
            var contextItem = ItemHelper.GetItem(contextItemId);
            if(contextItem == null)
            {
                return parameters;
            }
            parameters.Add("referring_page", SiteHelper.GetUrl(contextItem));  //You can add more parameters here
            return parameters;
        }
        protected void PostData(NameValueCollection parameters)
        {
            //POST Data to Third-party system
        }
        private static string GetValue(object field)
        {
            return field?.GetType().GetProperty("Value")?.GetValue(field, null)?.ToString() ?? string.Empty;
        }
}


/Views/FormBuilder/FieldTemplates/ContextItemId.cshtml

@using Sitecore.ExperienceForms.Mvc.Html
@model Sitecore.ExperienceForms.Mvc.Models.Fields.StringInputViewModel

@if (!Html.Sitecore().IsExperienceForms())
{
    <input id="@Html.IdFor(m => Model.Value)" name="@Html.NameFor(m => Model.Value)" type="hidden" value="@Sitecore.Context.Item.ID.ToString()" data-sc-field-name="@Model.Name" />
}
else
{
    <div class="form-group">
        <p class="form-control">
            Hidden Sitecore Context Item ID Field
        </p>
    </div>
}


NOTE:
Special thanks to Kamruz Jaman (@jammykam) and Mike Reynolds (@mike_i_reynolds) for pointing me to correct direction.


Friday, August 3, 2018

Sitecore Glass Mapper Experience Editor Error with Incorrect Glass Base Class ID Property Type

I was trying to get the Glass Mapper working with Sitecore 9 in Experience Editor mode and it returned following error.


Failed item resolve - You cannot save a class that does not contain a property that represents the item ID. Ensure that at least one property has been marked to contain the Sitecore ID. Type: Castle.Proxies.IPageBaseProxy
at Glass.Mapper.Sc.Configuration.SitecoreTypeConfiguration.ResolveItem(Object target, Database database) in C:\TeamCity\buildAgent\work\66b8bb468d084f35\Source\Glass.Mapper.Sc\Configuration\SitecoreTypeConfiguration.cs:line 214
at Glass.Mapper.Sc.GlassHtml.MakeEditable[T](Expression`1 field, Expression`1 standardOutput, T model, Object parameters, Context context, Database database, TextWriter writer) in C:\TeamCity\buildAgent\work\66b8bb468d084f35\Source\Glass.Mapper.Sc\GlassHtml.cs:line 560




I found an issue created for the same for Glass Mapper and it has mention following as a solution
https://github.com/mikeedwards83/Glass.Mapper/issues/113


Reason

In my Glass base class, I have defined the "Id" property of an item as follows


IGlassBase.cs  
[SitecoreInfo(SitecoreInfoType.OriginatorId)]
Guid Id { get; set; }


But once I have changed the "Id" property use "ID" attribute as follows, everything started to work as expected with a possibility of Experience Editor edits.

IGlassBase.cs   
[SitecoreId]
ID Id { get; set; }




NOTE: Credit of finding the solution should go to the @zbecknell who has written the final answer for that GitHub issue.