A few months ago, I started receiving the following exception on my website for one of my blogs:
System.Web.HttpException: The state information is invalid for this page and might be corrupted. ---> System.Web.UI.ViewStateException: Invalid viewstate
Immediately, I visited the webpage and it displayed fine. So I refreshed a bunch of times without receiving any errors. Then I tried viewing and posting comments with several browsers...nothing wrong. Then I opened up the code and reviewed it...it looked good. Since it was only happening to one blog, I thought it might have to do with the content of that blog...maybe I accidentally dropped a "<form>" or "<__VIEWSTATE>" tag in the content...nope! I was puzzled and kind of dismissed it for awhile.
Then it started happening more and more...on average, I now receive 2-3 of these errors per day. I started getting a little worried that a handful of visitors couldn't post comments to my website...but I had no ideas what to do.
Then I got a call from a customer. They purchased some blog spamming software and asked me to come to their office, figure out how it works and show them how to use it. Before going there, I researched the product and that's when I figured out my problem. The software I was reading up on asks you what keywords to search blog sites for. Next, it asks you for a blog comment. Finally, it searches the blog sites with the keywords you entered and posts the comment you entered. Not only does it get people to read your comment and visit your website, but it also increases your Google "PageRank" over time...genius! But be careful...if Google sniffs this out, you'll be blacklisted.
This is what is happening to my website...people are running software programs to leave spam comments and are causing exceptions to be thrown. The good news is that I now know it's now my software causing the problems and that I'm successfully blocking a lot of spam thanks to my Captcha code.
Below is the full exception message...I'm posting it so that it is indexed is search engines and others having this problem will now have resolution.
Page: Global.asax
Method: Application_Error
Exception: System.Web.HttpException: The state information is invalid for this page and might be corrupted. ---> System.Web.UI.ViewStateException: Invalid viewstate.
Additional Details:
Client IP: 65.88.129.2 Port: 46644 User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 2.0.50727; .NET CLR 1.1.4322) ViewState: sssssss Referer: Path: /BlogEntry.aspx ---> System.FormatException: Invalid length for a Base-64 char array. at System.Convert.FromBase64String(String s) at System.Web.UI.ObjectStateFormatter.Deserialize(String inputString) at System.Web.UI.ObjectStateFormatter.System.Web.UI.IStateFormatter.Deserialize(String serializedState) at System.Web.UI.Util.DeserializeWithAssert(IStateFormatter formatter, String serializedState) at System.Web.UI.HiddenFieldPageStatePersister.Load() --- End of inner exception stack trace --- --- End of inner exception stack trace --- at System.Web.UI.ViewStateException.ThrowError(Exception inner, String persistedState, String errorPageMessage, Boolean macValidationError) at System.Web.UI.HiddenFieldPageStatePersister.Load() at System.Web.UI.Page.LoadPageStateFromPersistenceMedium() at System.Web.UI.Page.LoadAllState() at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) at System.Web.UI.Page.ProcessRequest() at System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context) at System.Web.UI.Page.ProcessRequest(HttpContext context) at ASP.blogentry_aspx.ProcessRequest(HttpContext context) in c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\6486194d\28a90c6b\App_Web_znedlsbn.2.cs:line 0 at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)Inner Exc:System.Web.UI.ViewStateException: Invalid viewstate. Client IP: 65.88.129.2 Port: 46644 User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 2.0.50727; .NET CLR 1.1.4322) ViewState: sssssss Referer: Path: /BlogEntry.aspx ---> System.FormatException: Invalid length for a Base-64 char array. at System.Convert.FromBase64String(String s) at System.Web.UI.ObjectStateFormatter.Deserialize(String inputString) at System.Web.UI.ObjectStateFormatter.System.Web.UI.IStateFormatter.Deserialize(String serializedState) at System.Web.UI.Util.DeserializeWithAssert(IStateFormatter formatter, String serializedState) at System.Web.UI.HiddenFieldPageStatePersister.Load() --- End of inner exception stack trace ---Inner/Inner Exc:System.FormatException: Invalid length for a Base-64 char array. at System.Convert.FromBase64String(String s) at System.Web.UI.ObjectStateFormatter.Deserialize(String inputString) at System.Web.UI.ObjectStateFormatter.System.Web.UI.IStateFormatter.Deserialize(String serializedState) at System.Web.UI.Util.DeserializeWithAssert(IStateFormatter formatter, String serializedState) at System.Web.UI.HiddenFieldPageStatePersister.Load()
Comments
|
On
1/8/2010
Website Development in Surrey
said:
That was an inspiring post,
On
1/8/2010
Brian Pautsch
said:
Hi Noah,
On
1/8/2010
Satish Vellanki
said:
I was thinking whats wrong with my website!
On
3/8/2007
Noah
said:
Thanks for the info. Interestingly I still have been getting this same error on pages that have a captcha implementation. I might try switching out captcha code to see if that stops it (although there is nothign obvious in the post headers that indicate that they are correctly guessing the captcha code)... but I was wondering if you could point me in the direction of the blog spammer tool you checked out for your client. I was thinking I might put it on a vmware test box and try to see exactly how it is sneaking thru on my sites.
On
1/23/2007
Mirlisa
said:
Thanks for this! I've been having the same problem with my online application for months- I will check out the captcha solution.
On
12/29/2006
Brian Pautsch
said:
Are you kidding me? Read the blog and comments. It's all here...don't be lazy.
On
12/29/2006
Shahzad
said:
Could you please provide me the solution.
On
12/8/2006
Brian Pautsch
said:
If you'd like, send me the code and I'll check it out.
On
12/8/2006
Bhaskar
said:
Can you suggets a solution for this?
On
12/8/2006
Bhaskar
said:
I am getting the same exception when I am posting a Base64 converted string to a web service. As you mentioned its not happening every time, but most of the time
On
11/30/2006
Brian Pautsch
said:
My website is expecting a hidden ViewState variable and it's not there. When these robots post to the page, .NET can't find the ViewState and throws and exception...rightfully so. These exceptions should be ignored.
On
11/30/2006
Dave
said:
Yes, I too have the same problem.....do you know what the solution is?? Thanks.
On
10/17/2006
Brian Pautsch
said:
Did you read the entire blog...I tell you there.
On
10/17/2006
J Sriram
said:
I have the same problem. What is the solution?
|
Leave a Comment