[ PostPager.cs ] Index was out of range.

Topics: Controls
Dec 21, 2011 at 3:23 PM
Edited Dec 21, 2011 at 3:27 PM

Hello All,

Work Item: http://blogengine.codeplex.com/workitem/12228

This is my last error thats in my log that I can't seem to fix 

So this is it for today :)

Index was out of range.

Must be non-negative and less than the size of the collection.

Parameter name: index


Line 115:                if (midStack.Count < (MaxPages - 2))
Line 116:                {
Line 117:                    var last = int.Parse(midStack[midStack.Count - 1].ToString());   <---------------- Error
Line 118:                    for (var j = last + 1; j <= (MaxPages - 2); j++)
Line 119:                    {

Source File: c:\HostingSpaces\BrianDavis\programmingsolution.net\wwwroot\App_Code\Controls\PostPager.cs    Line: 117

Seems like again "bots" are causing this error but trying to go to a page index thats too big.

Like this: http://programmingsolution.net/?page=19    (Only have 16 pages)

It then gives the user the error:


Content Encoding Error
    
The page you are trying to view cannot be shown because it uses an invalid or unsupported form of compression.

The Logger and Elmah reports it as:

Message : Index was out of range. Must be non-negative and less than the size of the collection.

I think having it check if the query is larger than the max to just have the page="1"

Again most of these are "bots" triggered errors and might go unnoticed.

So everybody please check your logger.txt file for:

"Index was out of range. Must be non-negative and less than the size of the collection."

If you find it there please vote for the work item to be fixed.

Work Item: http://blogengine.codeplex.com/workitem/12228

Thanks,

Brian Davis

Dec 22, 2011 at 8:54 PM

bump :)

Dec 26, 2011 at 6:09 PM

This is now causing a 503 error I think.

Website went down with a 503 and this was one of the last Errors before it went down.

 

Just not 100% sure if this was the cause or not.

Dec 27, 2011 at 4:39 PM

bump

Coordinator
Dec 27, 2011 at 5:39 PM

You can just add "> 0" check to get rid of that error:

Line 115:                if (midStack.Count > 0 && midStack.Count < (MaxPages - 2))