Wednesday, May 07, 2008

RC4 encryption for classic ASP stops working 

This was an interesting gotcha which I'd like to blame on Visual Studio 2008, but it is undeserved.

Microsoft dropped support for Intellisense and color-coding for classic ASP in Visual Studio 2008, but I still use it to maintain some old sites.

Well, after some minor changes to an old site, suddenly, the RC4 encryption code, by Mike Shaffer, that I was using didn't work any more. The answer really surprised me.

To make a LONG story short, I opened the site in VS08 and created a new include file for a page I was modifying. I included the file into the primary page and that caused the RC4 code to stop producing the correct output.

Visual Studio 2008 created the new include file using UTF-8 encoding. Well, for some reason that broke the RC4 encryption code. I guess it's because each character would be 2 bytes instead of 1? I thought that was just Unicode and classic ASP won't even process a Unicode file (UNICODE ASP files are not supported). I don't know.

My resolution was to make sure the classic ASP page and all its includes were saved as ANSI text. Here Notepad++ (Menu > Format > Encode in ANSI) came in very handy again.

Maybe someday I will understand The Absolute Minimum Every Software Developer Absolutely, Positively Must Know About Unicode and Character. Scott Hanselman also has an interesting post on the CodePage versus the CharSet in classic ASP.

Microsoft Drops Classic ASP Support in Visual Studio 2008 

I upgraded to Visual Studio 2008 as soon as it came out. I was tempted to get rid of Visual Studio 2005 since VS08 had multi-targeting support and I assumed that the new Visual Studio had all the functionality of previous versions. Well, I was wrong.

For better or worse, I still have to support some Classic ASP and VBScript code, well Microsoft dropped Intellisense and color-coding for classic ASP. Recommended solution: Keep my 2.5 GB install of VS05 around for those days when you need it.

I can't believe it myself. How detrimental or hard was it to maintain even just basic syntax highlighting? Even an open source product like Notepad++ offers that. Wow.

I recently found another gotcha which I will include in another post.

UDPATE [5/12/2008]: Looks like VS08 SP1 will bring back support for classic ASP. Cool!

Labels: , , , , ,


This page is powered by Blogger. Isn't yours?