Thursday, September 25, 2008

JavaScript HTMLEncode function

Found this neat trick on another blog (http://lunarmedia.com/blogs/lunarmedia_blog/archive/2006/10/23/120405.aspx) to escape characters for presentation in HTML:

function escapeHTML (str)
{
   var div = document.createElement('div');
   var text = document.createTextNode(str);
   div.appendChild(text);
   return div.innerHTML;
}; 

Thursday, September 18, 2008

IDIOTIC WebResource.axd workaround

I was tasked with moving an ASP.NET 3.5 website from one web server to another.  Everything worked great on the second server, except I was getting 404 errors anytime an embedded resource was requested with a WebResource.axd URL.

I went all over Google looking for the answer, and found a workaround that works, but is absolutely ridiculous:

Place an empty WebResource.axd file at the location that is 404'ing.

I'm sure this has something to do with HTTP handlers and priorities and the like, but whatever the real issue is, it is so obscure that I'm going to use this workaround for now and move on.

Ugh.