The problem is solved with the help of ESRI technical support. The string was not being parsed correctly. In the proxy.ashx file, in the ProcessRequest function, the following line:
string uri = Uri.UnescapeDataString(context.Request.QueryString.ToString());
must be changed to:
string uri = context.Request.Url.Query.Substring(1);
As Dasa mentioned, this has already been fixed in the new asp.NET proxy with the link provided in Dasa's last post, but as far as I can tell this doesn't work with a dynamic proxy, so if you use the dynamic proxy created by Thang Le mentioned in my last post, you would need to make this change if using wildcards in your where clause.
Sebastian Roberts