Category Archives: General .NET

Issues related to general .NET and C# development

The URL-encoded form data is not valid error in Sitecore Page Editor

In ASP.NET 3.5 you may encounter one of the following error messages: “Operation is not valid due to the current state of the object” or: “The URL-encoded form data is not valid” WHY? Microsoft released a Security update at dec 29 … Continue reading

Posted in General .NET, Sitecore 6 | Tagged , , | Leave a comment

Sitecore 404 without 302

It’s a well known issue that when Sitecore displays a 404 page, it’s done by doing a 302 redirect to the 404 page, hence the 302 status code is thrown before the 404. The behavior is partially because of the … Continue reading

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

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

Google Maps for Sitecore

Finally the Advanced Sitecore Google Maps (WCAG Edition) for Sitecore has been upgraded to use the V3 API of Google Maps. Advanced Sitecore Google Maps is a commercial module for Sitecore that allows you to add Google Maps to your Sitecore … Continue reading

Posted in c#, General .NET, Sitecore 6 | 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

Open Media Library from Sitecore Page Editor

This article describes how you can add your own button to the Sitecore Page Editor. In a previous post I explained how to edit hidden fields in the Page Editor. This post is about managing media contents, and to do … Continue reading

Posted in c#, General .NET, Sitecore 6 | 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

Sitecore.Diagnostics.Assert statements

Recently I was corrected by my colleague Alan Coates about my use of Assert statements in my code, which gave me the opportunity to write this article. Sitecore has a fundamental Assert (Sitecore.Diagnostics.Assert) namespace which differs fundamentally from the .NET Debug.Assert … Continue reading

Posted in c#, General .NET, Sitecore 6 | Tagged , , , , , | 2 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