Tuesday, 25 March 2008

Validate XML in IE using JavaScript

Slightly off-topic, but as there don’t seem to be many good examples on the web of how to validate an XML document in IE using JavaScript, here’s a quick snippet. In the event of an XML error, an error message is displayed in the div.
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>XML Validator</title>

<script type="text/javascript">
function loadit()
{
var xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
xmlDoc.validateOnParse = true;
xmlDoc.async="false";
xmlDoc.load("MyXmlFile.xml");

if (xmlDoc.parseError != '0')
{
document.getElementById("error").innerHTML
= xmlDoc.parseError.reason;
}

}
</script>

</head>
<body onload="loadit();">
<div id="error">
</div>
</body>
</html>

Wednesday, 19 March 2008

Windows Firewall has blocked some features of a program

Should I keep blocking this program?

Unable to find script library '/aspnet_client/ system_web/1_1_4322/WebUIValidation.js'

If you get this error using .NET 1.1, try reinstalling the JavaScript file by navigating to your Framework directory (eg. C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322) and running the following command:

aspnet_regiis -c

Create a virtual directory under your web site root called ‘aspnet_client’ with all the default options and point it to the aspnet_client folder under the web root (eg. C:\Inetpub\wwwroot\aspnet_client).

Make sure you have appropriate backups before attempting these suggestions, in case you need to roll back.

Error Saving a Query String to a Cookie

Here’s one to note. I have some code that saves the requested URL to a cookie and later retrieves it. The strange thing was that when retrieving the value, anything after an ampersand in the query string was lost. The solution was to encode the Url using UrlEncode() (not HtmlEncode()).

Response.Cookies["RequestedPage"].Values.Add("Url", HttpUtility.UrlEncode(value))

Wednesday, 12 March 2008

The following applications should be closed before continuing with set-up

Installing the .NET 3.5 Framework on a server this morning, I got this beauty of an error message:


Superb.

Tuesday, 11 March 2008

Root element is missing

This exception arises if you store the Sitecore and Sitecore Modules folders outside of the web root and have forgotten to create virtual directories under the web root that point to them.

How many CMS developers does it take to change a light bulb?

None. It's a content issue.

(Sorry.)