Posts

Showing posts from December, 2013

Using Sitecore.Logging to send emails

BACKGROUND In this post I will show you how to send an email using the Sitecore.Logging namespace. If you want to get straight to the code here you go ! PROBLEM WE NEED TO SOLVE Do you need to send emails when something happens in your Sitecore website?  For example, if you get a critical error and want to email this to a distribution list?       Using Sitecore.Diagnostics you can log this error to the Sitecore log, but you still need that email sent to get someone working on the issue asap! Many solutions exist to fit this need.  You can use System.Net, you can use nLog or a plethora of other logging systems. But why not use what you already have with Sitecore?    Sitecore went ahead and wrapped up the log4net code inside their own dll,  Sitecore.Logging.dll.    You can use your favorite .NET decompiler to look at the code.    I use Telerik's Just Decompile to look under the hood of the Sitecore.Logging.dll.   Remember, adding another dll to the application domain take

Conditional caching components in Sitecore MVC

Image
I'm writing this post to help remember why I chose a particular solution and to hopefully help anyone else in the same scenario. I will start off by stating the problem I needed to solve, a couple options I reviewed and why I chose a particular solution.  We are using Sitecore 7.0 and since Sitecore 7.0 requires ASP.NET MVC 3 we are using ASP.NET MVC 3.   We are also using Glass Mapper and love it :-). PROBLEM:    Users came to me with a late requirement.  They want the ability to add renderings above and below an items content.   The renderings they want must access the database each time they are rendered to show accurate data. How can we efficiently handle this situation without making major changes to the current design? BACKGROUND:    Our items are made from a template that has four sections.  (Other sections exist but for this discussion these sections are the only ones relevant).   Each section consists of the following fields,  Content ,  Active  and  Style .