Wednesday, 24 February 2010

Classic ASP (VBScript) - Type mismatch: 'URLEncode'

Just a quick note - half aide memoir and half you-never-know-when-this-might-come-in-handy. We do quite a lot of maintenance work on Classic ASP (VBScript) sites and there are loads of gotchas.

Back in the day when it one of the main technologies I used they got me less, I seem to remember, but nowadays thats not entirely the case!

It's the obtuse error message that got me this time.

baseString = URLEncode(baseString)

Generates this error:

Microsoft VBScript runtime error '800a000d'

Type mismatch: 'URLEncode'

The fix? Simple.

baseString = Server.URLEncode(baseString)

DOH! Hopefully if this trips you up, you'll find this post in less time than it took me to realise what a doughnut I was being..!


Jemmeh said...

Thanks Grumpy person.