Category Archives: .net

Sitecore Links with LinkManager and MediaManager

This article describes how Sitecore handles internal and external links, how you can resolve the correct URL to an item, and what you should know about links when building multisite and multilanguage websites. To render a corrent URL you use … Continue reading

Posted in Sitecore 6, .net, c# | Tagged , , , , | 1 Comment

Validate CheckBoxList using a CustomValidator

In this article I explain how you can validate that at least one checkbox is checked in an asp:CheckBoxList using an asp:CustomValidator, and how to make it work server side and client side. None of the built in .net validators … Continue reading

Posted in .net, c#, General .NET | Tagged , , , , , , , , | 3 Comments

An existing connection was forcibly closed by the remote host

This error occured randomly in my project when I tried to read images from a HttpWebRequest. The exception is: Exception: System.IO.IOException Message: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host. Nested … Continue reading

Posted in .net, c#, General .NET | Tagged , , , , , | 2 Comments

Custom 404 page ignored by IIS 7

If your IIS does not display your own custom error page, this might be the problem – and the solution: I recently had to implement a custom 404 error page. The code for that is pretty simple. In the web.config, … Continue reading

Posted in .net, c#, General .NET | Tagged , , | 2 Comments

Javascript string encoding in C#

In a previous post I explained how you can use the C# System.Uri.EscapeDataString() to encode strings to be later decoded by the equvivalent JavaScript decodeURIComponent(). The method above is still valid when encoding HTML tags, but fails short when encoding … Continue reading

Posted in .net, c#, General .NET | Tagged , , , | 2 Comments

Reading mails using IMAP and MailSystem.NET

In this article I will describe how you can use C# and MailSystem.NET to read mails from any IMAP source, including GMail. MailSystem.NET is a Open Source, GNU Library General Public Licensed library for managing emails using SMTP, POP3, IMAP … Continue reading

Posted in .net, c# | Tagged , , , , , | 22 Comments

Using Sitecore Jobs

Sitecore contains a job system, allowing you to start and run jobs in the background. Jobs are perfect for long running operations. Scheduled tasks is jobs that is started at certain time. Jobs have no HttpContext and, depending on how … Continue reading

Posted in .net, c#, Sitecore 6 | Tagged , , | 4 Comments

XElement get default values using extension methods

I often work with dynamic XML documents which might or might not contain the element, field or attribute that I am looking for. The Standard .NET XElement class is pretty strict (as it should be) and returns a null reference … Continue reading

Posted in .net, c#, General .NET | Tagged , , , , | 1 Comment

Using Sitecore EditFrame in PageEdit

The sc:EditFrame is a Sitecore Page Editor (called Content Editing in Sitecore marketing terminology) feature that allows front end access to fields that are not directly accessible, either because they are not visible or they are of a type that … Continue reading

Posted in General .NET, Sitecore 6, .net, c# | Tagged , , , , , | 7 Comments

Parse namevalue collection with quotation marks handling

Parsing of namevalue collections is a common pattern. .NET have build in parsing of Query Strings, and other bloggers have solutions on how to do this. This is Yet Another NameValueCollection parser. It will parse not only query strings, but also … Continue reading

Posted in .net, c#, General .NET | Tagged , , , , , , | Leave a comment