Quantcast
Channel: General .NET – Brian Pedersen's Sitecore and .NET Blog
Browsing all 167 articles
Browse latest View live

Image may be NSFW.
Clik here to view.

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...

View Article


Image may be NSFW.
Clik here to view.

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...

View Article


Image may be NSFW.
Clik here to view.

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...

View Article

Image may be NSFW.
Clik here to view.

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...

View Article

Image may be NSFW.
Clik here to view.

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...

View Article


Image may be NSFW.
Clik here to view.

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...

View Article

Image may be NSFW.
Clik here to view.

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...

View Article

Image may be NSFW.
Clik here to view.

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...

View Article


Image may be NSFW.
Clik here to view.

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...

View Article


Image may be NSFW.
Clik here to view.

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...

View Article

Image may be NSFW.
Clik here to view.

.NET DateTime to JSON UNIX JavaScript datetime

When posting datetimes to web services or REST services, you might need to convert the standard .NET DateTime to a UNIX format. Please note than neither REST, nor JavaScript has its own DateTime...

View Article

Image may be NSFW.
Clik here to view.

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...

View Article

Image may be NSFW.
Clik here to view.

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

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...

View Article


Image may be NSFW.
Clik here to view.

Avoid the use of Sitecore.Context.Item

Or: How Sitecore DMS and Personalization killed the Sitecore.Context.Item. This post is about how to properly ensure that you get data from the correct item when you develop websites that can be...

View Article

Image may be NSFW.
Clik here to view.

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...

View Article


Image may be NSFW.
Clik here to view.

Get Sitecore placeholders and rendering hierarchy from a Sitecore item

This article explains how you can get the hierarchy of placeholders and render them to your screen for debugging or documentation purposes. The Sitecore rendering engine allows you to place sublayouts...

View Article

Image may be NSFW.
Clik here to view.

Unable to serialize the session state. In ‘StateServer’ and ‘SQLServer’ mode

When switching the sessionState mode of your web project from InProc to SQLServer you might encounter this error: Exception: System.Web.HttpException Message: Unable to serialize the session state. In...

View Article


Image may be NSFW.
Clik here to view.

URL Rewrite and Sitecore

The Microsoft URL Rewrite module is an ISS extension that allows you to rewrite one URL to another using regular expressions. The extension is like the Sitecore aliases on steroids, and is especially...

View Article

Image may be NSFW.
Clik here to view.

Add text to asp:ValidationSummary (C#)

This trick is especially useful when you have custom code to be executed after your form have been submitted, and still wishes to communicate an error the same way as you communicate form validation...

View Article

Image may be NSFW.
Clik here to view.

Measuring Sitecore performance with HighResTimer

The HighResTimer is a Sitecore feature that has been around since Sitecore 4. It’s a simple timer that allows you to very precisely measure time in microseconds by using the underlying OS timers. It is...

View Article
Browsing all 167 articles
Browse latest View live