ViewState Warning - Question.

For general questions and discussions specific to the AbleCommerce GOLD ASP.Net shopping cart software.
Post Reply
josephmrogers
Ensign (ENS)
Ensign (ENS)
Posts: 1
Joined: Thu Apr 13, 2017 9:56 am

ViewState Warning - Question.

Post by josephmrogers » Thu Apr 20, 2017 3:55 am

Hello,

We have two sites with nearly identical code bases. In the error log for one of them we receive continual warnings for the ViewState size for a handful of pages. The other site does not receive these warnings.

I see a key value in the ablecommerce.config: <item key="ViewStateWarningSize" value="0" />

Currently, this is the same in both sites: value = 0. I can change that value in the site that receives the warnings and the warnings will not be logged if the ViewState is below it as expected, but in the site where the warnings are not thrown the value = 0 and nothing is logged. Note: The ViewState in the site that does not throw the error is smaller than the one that does.

The config change would be an acceptable answer as the ViewStates are not overly large to begin with, but it begs the question: what other configuration could keep the warnings from being entered into the log?

Thank you.

User avatar
AbleMods
Master Yoda
Master Yoda
Posts: 5170
Joined: Wed Sep 26, 2007 5:47 am
Location: Fort Myers, Florida USA

Re: ViewState Warning - Question.

Post by AbleMods » Tue May 09, 2017 5:53 am

If you look in the global.asax file, you'll see in the Application_Error() method that Able has written some code to ignore specific errors. You could add your viewstate error in that section and it would be prevented from logging to the Able error log(s).

I've had to do it a few times in the past, usually from annoying bots hitting the site in odd ways causing unusual .Net exceptions.

Code: Select all

                    if (exception is HttpException)
                    {
                        // IGNORE 404 RESOURCE NOT FOUND ERRORS
                        if (((HttpException)exception).GetHttpCode() == 404)
                            return;
                        // IGNORE "POTENTIALLTY DANGEROUS" REQUESTS GENERATED BY HACKERSAFE
                        if (((HttpException)exception).Message.StartsWith("A potentially dangerous"))
                            return;
                        // IGNORE "An error occurred while communicating with the remote host" generated by 
                        // file downloads that were cancelled before completed
                        if (((HttpException)exception).Message.StartsWith("An error occurred while communicating with the remote host"))
                            return;
                        // IGNORE "REMOTE HOST CLOSED CONNECTION" REQUESTS GENERATED BY DIGITAL ASSET DOWNLOADS
                        if (((HttpException)exception).Message.StartsWith("The remote host closed the connection"))
                            return;
                    }

Joe Payne
AbleCommerce Custom Programming and Modules http://www.AbleMods.com/
AbleCommerce Hosting http://www.AbleModsHosting.com/
Precise Fishing and Hunting Time Tables http://www.Solunar.com

Post Reply