Tutorial :Intermittent ADO Recordset object error in Classic ASP script



Question:

I'm very infrequently seeing the following error logged on a website I manage:

Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another

When I access the classic ASP page myself, I cannot duplicate the problem. Notably, the user agent is nearly always:

ia_archiver (+http://www.alexa.com/site/help/webmasters; crawler@alexa.com)

The script is a product search page, which uses rather standard ASP paging. The relevant code looks like this:

...  Set rs=Server.CreateObject("ADODB.Recordset")       rs.CacheSize = iPageSize  rs.PageSize = iPageSize  rs.Open mySQL, Conntemp, adOpenStatic, adLockReadOnly, adCmdText  ...  

I'm fairly sure that the cursor and lock type are correct. Obviously if they were wrong, I would expect the script not to work at all. The only thing I can think of, is that is is something to do with the recordset object still being open (and the connection pooled), while the Alexa spider hits the site again, causing the conflict.

Does anyone have any ideas as to how to solve this? The error happens rarely (1 per month on 500,000 page views), but still, I like to make sure there are no bugs if possible. The only thing I can think of as a workaround is to use the robots.txt to exclude robots from this page.

Regards

Junto


Solution:1

Are you doing some checks on the input from the browser before you start throwing it into a function, could be you are assuming that a variable is going to be good when it might not be?

For instance. Whats your query string like?

If its like this ?page=4 and you read that in as the page you want assuming its all good as it must have been generated from your code. What happens if I just typed that in though and there is no page 4? I think thats more likely to be your problem.

Could be Alexa is guessing that you might have a load of pages it can index just from your query string. ie it might see that you always have something like ?page=X so loops through them all to make sure it gets them all and stops when it gets an error/404? Just spit balling on that one though.


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »