ArcGIS Javascript Api - QueryTask and setDefinitionExpression

I've written some code to query a Feature Layer using either a QueryTask or using the setDefinitionExpression when adding the layer.

For testing I am using the ASP.Net Development Server.

I've noticed (via Fiddler) that when my "where" statement is large, my request automatically changes from a GET to a POST. Occasionally however my request fails with an " is not set." error.

In researching this error I have found that it may be due to the length of the URL exceeded the maximum length, and that to workaround this issue I should use a proxy, in order to perform a POST. I am however confused by this because I am already seeing my requests change from using a GET to a POST.

When performing a query using a large where clause,does the request in fact get changed from a GET to a POST when necessary? If so, is the use of a proxy still necessary in this case.

your assumption is correct. the JSAPI switches to POST automatically when required. If the request is interpreted as being sent to a different domain than where the application resides and either the service handling the query or browser don't support CORS, a proxy is required.