Category Archives: .net

JavaScript ReferenceError: Can’t find variable: __doPostBack

This error can occur in asp.net pages. In certain situations .net will fail to create the __doPostBack JavaScript function and the hidden __EVENTVALIDATION input field. The situations that can cause this are: When using asp:ImageButton or asp:LinkButton controls AND: When viewing … Continue reading

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

Merge Sitecore layout details using XmlDeltas

One of the features that Sitecore introduced somewhere in the Sitecore 6.x range is “Layout Deltas“,  the possibility to merge an item’s layout details with the layout details on the item’s __Standard Values template. It means that you can add sublayouts to the __Standard … Continue reading

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

Custom rules and conditions for Sitecore personalization

In Sitecore it is possible to change the sublayouts or data sources on a page depending on conditions. This means that users can see the same page differently, depending on a set of rules. Sitecore comes standard with a set of standard … Continue reading

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

(System.Web.UI.HtmlControls.HtmlIframe) is not compatible with the type of control (System.Web.UI.HtmlControls.HtmlGenericControl)

Yesterday I got the following error: Parser Error Message: The base class includes the field ‘IFrame’, but its type (System.Web.UI.HtmlControls.HtmlIframe) is not compatible with the type of control (System.Web.UI.HtmlControls.HtmlGenericControl). Source Error: Line 14: <iframe id=”IFrame” frameborder=”0″  runat=”server” visible=”false”/> Reason: The code … Continue reading

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

A potentially dangerous Request.QueryString value was detected from the client

One of my colleagues encountered this error in Sitecore 6.6: A potentially dangerous Request.QueryString value was detected from the client You might think that this error was caused by the Microsoft AntiCSRF implementation by Sitecore.  But it is not, it’s … Continue reading

Posted in .net, General .NET, Sitecore 6, Sitecore 7 | 1 Comment

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 .net, c#, 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 , , , , , , , , | 6 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 , , , , , | 7 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 , , | 3 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 , , , | 4 Comments