Sitecore Error (SOLVED): An item name cannot contain any of the following characters: \/:?”\-|[] (controlled by the setting InvalidItemNameChars)

You may have ran into an issue during deployments when trying to publish in the past where you have seen this message:

“An item name cannot contain any of the following characters: \/:?”<>\-|[] (controlled by the setting InvalidItemNameChars)”

In order to help move forward on this you need to disable the default ItemNameValidation settings if you are having some deployment issues.

To do that (would only recommend temporarily) you can follow the steps below:

Add a config file to App_Config/Include named z.DisableItemNameValidation.config and put this in it:

<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
  <sitecore>
    <settings>
      <setting name="ItemNameValidation">
        <patch:attribute name="value"></patch:attribute>
      </setting>
    </settings>
  </sitecore>
</configuration>

Again, when you are finished I would recommend taking this back out of your files to keep things as standard as possible.

How to deal with: WARN An invalid character was found in the mail header: ‘,’ in Sitecore

If you are using Web Forms for Marketers in Sitecore then you may have an occasion where the email addresses that are being used to send messages to get updated by someone…then all of a sudden you start getting errors…then all of a sudden your phone starts ringing off the hook, right?

So in the Sitecore logs you will see something similar to:

 868 13:12:53 WARN An invalid character was found in the mail header: ','.
Exception: System.FormatException
Message: An invalid character was found in the mail header: ','.
Source: System
 at System.Net.Mail.DotAtomReader.ReadReverse(String data, Int32 index)
 at System.Net.Mail.MailAddressParser.ParseDomain(String data, Int32& index)
 at System.Net.Mail.MailAddressParser.ParseAddress(String data, Boolean expectMultipleAddresses, Int32& index)
 at System.Net.Mail.MailAddressParser.ParseMultipleAddresses(String data)
 at System.Net.Mail.MailAddressCollection.ParseValue(String addresses)
 at System.Net.Mail.Message..ctor(String from, String to)
 at System.Net.Mail.MailMessage..ctor(String from, String to)
 at System.Net.Mail.MailMessage..ctor(String from, String to, String subject, String body)
 at Sitecore.Form.Core.Pipelines.ProcessMessage.ProcessMessage.GetMail(ProcessMessageArgs args)
 at (Object , Object[] )
 at Sitecore.Pipelines.CorePipeline.Run(PipelineArgs args)
 at Sitecore.Form.Core.Submit.SubmitActionManager.ExecuteSaving(ID formID, ControlResult[] list, ActionDefinition[] actions, Boolean simpleAdapt, ID sessionID)

Huh? OK, so let’s go look at the Web Form Send Email action in question:

ss1wffm

Nothing looks odd at first…until upon further research: I discovered after some reading about mail headers that the last entry of the recipients (To, CC, BCC) cannot accept a separator delimiter as a character on the end. You’ll also notice in outlook and other email clients that the behavior is the same.

The fix? remove the last character and save/republish your form. Problem solved!

ss2wffm

Hope this helps. Questions are welcome!

Getting “Error: this template attempted to load component assembly Sitecore.Rocks.TemplateWizard…” ? Try this…

At some point in your early Sitecore career you will likely encounter the following error:

sitecorerockserror

Perhaps you tried uninstalling and reinstalling Sitecore Rocks but still had the issue? Here’s what happened in my battle with troubleshooting.

So I finally went and found the Sitecore.Rocks.TemplateWizard.dll and copied it to:

C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\PublicAssemblies

If you have trouble finding where those assemblies are then look where the extension was installed. For me it was starting here

C:\Users\username\AppData\Local\Microsoft\VisualStudio\12.0\Extensions

Once there I browsed the directories until I found it.

(Others I know have had to copy to Visual Studio 10 and 11 as well)

These steps did fix the issue and allowed the template wizard to run when creating a layout.

If you are still receiving other errors after this you may need to also bring in some other files. What was missing was a good number of other dlls:

  • Sitecore.Rocks.Validation.dll
  • Sitecore.Rocks.Validation.Runner.config.xml
  • Sitecore.Rocks.Validation.Runner.exe
  • Sitecore.Rocks.Validation.Runner.exe.config
  • Sitecore.Rocks.VisualStudio.dll
  • Sitecore.Rocks.VisualStudio.pkgdef
  • (and of course Sitecore.Rocks.TemplateWizard.dll)

After copying these out to the folder mentioned above and restarting Visual Studio, my issue was resolved. Hope that helps.

Encrypt And Decrypt A Sitecore ConnectionStrings.Config File

Encrypting .Net application web.config files are easy enough. However Sitecore is NOT a fan of you messing with the web.config. This is even part of the reason the connection strings are stored out into a separate file in Sitecore. I’ll go through a quick method of taking care of doing it on the separate Sitecore file.

  • Ensure you have .Net framework installed where you are going to perform the encryption (my examples are 4.0, you can use 2.0 if need be)
  • !!!IMPORTANT!!! Make a backup of your Sitecore ConnectionStrings.config file
  • Create a folder on C: to hold your encrypt/decrypt batch files (example will be C:\decrypter) where the .Net framework exists
  • Open notepad and create a batch file (encrypt.bat), put the following in for your encryption statement and then save it to your folder you just created
echo Encrypting app_config/connectionstrings.config
 C:\Windows\Microsoft.NET\Framework64\v4.0.30319\aspnet_regiis.exe -pef "connectionStrings" "C:\decrypter"
 Pause
  • Repeat this step for the decryption statement (decrypt.bat)
echo Encrypting app_config/connectionstrings.config
 C:\Windows\Microsoft.NET\Framework64\v4.0.30319\aspnet_regiis.exe -pdf "connectionStrings" "C:\decrypter"
 Pause
  • Create a blank web.config (THIS IS YOUR WEB.CONFIG YOU MADE AND NOT THE SITECORE WEB.CONFIG!!!), put and wrap your Sitecore connection strings (from ConnectionStrings.config) inside and save it to the folder you created. it should look something like:
<?xml version="1.0" encoding="utf-8"?>
 <configuration>
 <connectionStrings>
 <add name="core" connectionString="user id=sitecoreuser;password=sitecorepw;Data Source=servernameorip;Database=Sitecore_Core" />
 <add name="master" connectionString="user id=sitecoreuser;password=sitecorepw;Data Source=servernameorip;Database=Sitecore_Master" />
 <add name="web" connectionString="user id=sitecoresql;password=sitecorepw;Data Source=servernameorip;Database=Sitecore_Web" />
 <add name="reporting" connectionString="user id=sitecoresql;password=sitecorepw;Data Source=servernameorip;Database=Sitecore_Analytics" />
 </connectionStrings>
 </configuration>
  •  Once you have both batch files and the web.config then run the encrypt batch file as an administrator. It will look something like this:

encrypt

  • You’ll then have a web.config in your folder now similar to this:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<connectionStrings configProtectionProvider="RsaProtectedConfigurationProvider">
<EncryptedData Type="http://www.w3.org/2001/04/xmlenc#Element"
xmlns="http://www.w3.org/2001/04/xmlenc#">
<EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#tripledes-cbc" />
<KeyInfo xmlns="http://www.w3.org/2000/09/xmldsig#">
<EncryptedKey xmlns="http://www.w3.org/2001/04/xmlenc#">
<EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#rsa-1_5" />
<KeyInfo xmlns="http://www.w3.org/2000/09/xmldsig#">
<KeyName>Rsa Key</KeyName>
</KeyInfo>
<CipherData>
<CipherValue>(you'll have a long cipher here)</CipherValue>
</CipherData>
</EncryptedKey>
</KeyInfo>
<CipherData>
<CipherValue>(you'll have a long cipher here)</CipherValue>
</CipherData>
</EncryptedData>
</connectionStrings>
</configuration>
  • Once completed take the connectionStrings section of the web.config and replace your ConnectionStrings.config file with the encrypted connectionStrings section (run notepad in admin mode if your sitecore is in the web root).
  • Recycle the app pool to refresh. You should now be encrypted!
  • If this fails for you at some point then replace your Sitecore connectionStrings.config file with the backup you took at the start.
  • And yes, to decrypt (to update your strings) put your encrypted connectionstrings section in your web.config (THIS IS YOUR WEB.CONFIG YOU MADE AND NOT THE SITECORE WEB.CONFIG!!!) in the windows folder you made and run the decrypt.bat as an admin. You should get:

decrypt

Again, I hope this helps someone. Questions and comments are always welcome! And for the sake of hoping I catch the skimmers here, DO NOT MODIFY THE SITECORE WEB.CONFIG. DO THIS ON THE CONNECTIONSTRINGS.CONFIG! You have been warned…

Connect Sitecore xDB To A MongoDB On Rackspace’s ObjectRocket Platform With SSL

This was a fun experience. Anyway, let’s go. Got a 5GB $149/mo Medium pricing package from Object Rocket (Note: Small does not have SSL in its package).

ORPricing

So after you get someone to kindly pay for your package then you will get a login to Object Rocket and (more importantly) the ability to create a mongodb instance:

instance

Then once you have your instance you can create your user to add to the instance:

adduser

Once you have an instance and a user added to it then grab your SSL address:

address

So now you have instance databases, a database user, and a SSL address to connect to. From here we move to Sitecore. For the sake of keeping this short we are going to assume you have Sitecore Analytics enabled in your instance.

Once you have worked your magic then navigate to your ConnectionStrings.config (located in your web root/Website/App_Config and add the connection strings for the four pieces (analytics, tracking.live, tracking.history, and tracking.contact):

<add name="analytics" connectionString="mongodb://easyaspieuser:easyaspiepassword@iad-mongos2.objectrocket.com:25123/EASYASPIE_analytics?ssl=true;sslverifycertificate=false" />
<add name="tracking.live" connectionString="mongodb://easyaspieuser:easyaspiepassword@iad-mongos2.objectrocket.com:25123/EASYASPIE_live?ssl=true;sslverifycertificate=false" />
<add name="tracking.history" connectionString="mongodb://easyaspieuser:easyaspiepassword@iad-mongos2.objectrocket.com:25123/EASYASPIE_tracking_history?ssl=true;sslverifycertificate=false" />
<add name="tracking.contact" connectionString="mongodb://easyaspieuser:easyaspiepassword@iad-mongos2.objectrocket.com:25123/EASYASPIE_tracking_contact?ssl=true;sslverifycertificate=false" />

A couple things of note:

  • ssl=true indicates to sitecore and mongo that you are going to connect with SSL.
  • You can test your connection with a tool like Robomongo or Mongovue.
  • If you have an instance that has a network appliance in front of it (like in my case) then you will need to add sslverifycertificate=false to keep the SSL connection from trying to read a .pem file from you.
  • Parameters you pass need to be separated by a semi-colon. Yes, I thought ampersand as well (and even see it documented as such here). ObjectRocket was kind enough to help me figure that out.
  • If you are in a DMZ that is heavily firewalled then you will need the port number firewall exception put in for you (for my example it would be TCP 25123)
  • Troubleshoot by reading the Sitecore logs (usually located in your website instance/data/logs/)

Getting a successful connection will bring up data:

analytics

I hope this helps, questions are welcome!

Sluggish Sitecore Development Environment? Here’s An Easy Method To Disable Sitecore Analytics

When you install a new 8.0 instance of Sitecore you will find the site can be laggy and sluggish to load. To speed up your dev environment I would recommend this easy fix.

First create a folder called z in your app config sitecore path: C:\inetpub\wwwroot\yoursitecore\Website\App_Config\z

Then, create a file called zwoa.config and paste the following in:

<configuration xmlns:patch="<a href="http://www.sitecore.net/xmlconfig/">http://www.sitecore.net/xmlconfig/</a>">
 <sitecore>
 <pipelines>
 <initialize>
 <processor type="Sitecore.Pipelines.Initialize.PrecompileSpeakViews, Sitecore.Speak.Clientpro" >
 <patch:delete />
 </processor>
 <processor type="Sitecore.ContentTesting.Pipelines.Initialize.RegisterContentTestingCommandRoute, Sitecore.ContentTesting" >
 <patch:delete />
 </processor>
 <processor type="Sitecore.Pipelines.Initialize.PrecompileSpeakViews, Sitecore.Speak.Client" use="ContentTesting" >
 <patch:delete />
 </processor>
 </initialize>
 <mvc.renderPageExtenders>
 <processor patch:after="processor[@type='Sitecore.Mvc.ExperienceEditor.Pipelines.RenderPageExtenders.RenderExtendersContainer, Sitecore.Mvc.ExperienceEditor']" type="Sitecore.Mvc.ExperienceEditor.Pipelines.RenderPageExtenders.RenderPageEditorExtender, Sitecore.Mvc.ExperienceEditor"></processor>
 <processor patch:after="processor[@type='Sitecore.Mvc.ExperienceEditor.Pipelines.RenderPageExtenders.RenderExtendersContainer, Sitecore.Mvc.ExperienceEditor']" type="Sitecore.Mvc.ExperienceEditor.Pipelines.RenderPageExtenders.RenderPreviewExtender, Sitecore.Mvc.ExperienceEditor"></processor>
 <processor patch:after="processor[@type='Sitecore.Mvc.ExperienceEditor.Pipelines.RenderPageExtenders.RenderExtendersContainer, Sitecore.Mvc.ExperienceEditor']" type="Sitecore.Mvc.ExperienceEditor.Pipelines.RenderPageExtenders.RenderDebugExtender, Sitecore.Mvc.ExperienceEditor"></processor>
 <processor type=""Sitecore.Mvc.ExperienceEditor.Pipelines.RenderPageExtenders.SpeakRibbon.RenderPageEditorSpeakExtender, Sitecore.Mvc.ExperienceEditor" >
 <patch:delete />
 </processor>
 </mvc.renderPageExtenders>
 </pipelines>
 <settings>
 <setting name="Analytics.Enabled" > <patch:attribute name="value" value="false" />
 </setting>
 </settings>
 </sitecore>
 </configuration>

Refresh your Sitecore in a web browser and watch it go!