Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 699993
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T03:26:52+00:00 2026-05-14T03:26:52+00:00

Monitoring my global exception logs this error seems to be impossible to remove no

  • 0

Monitoring my global exception logs this error seems to be impossible to remove no matter what I do, I thought I finally got rid of it but it’s back again. You can see a strack trace of the error on a similar post here.

Notes about the environment:

IIS 6.0, .NET 3.5 SP1 single server ASP.NET application

Steps already taken:

  <system.web>
    <machineKey validationKey="big encryption key"
      decryptionKey="big decryption key"
      validation="SHA1" decryption="AES" />

In my Page Base for all of my pages

  protected override void OnInit(EventArgs e)
  {
    const string viewStateKey = "big key value";

    Page.ViewStateUserKey = viewStateKey;
  }

Also in the source of the page I can see that all of the ASP.NET generated hidden fields are correctly at the top of the page.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T03:26:52+00:00Added an answer on May 14, 2026 at 3:26 am

    First of all lets start from the fact, that this error of view state happens on PostBack.

    Also I must say that I have done all the things that every one suggest to do to avoid this problem. And I have single machine, but 2 pools that run the same Pages.

    So someone do an action, ether a man, ether some other search machine by ‘clicking’ on your pages, or some hacker try to check your system for problems…

    I have similar problems (rare but existing ones), and I finally found that people try to hack-test my pages. (from the same IP I have and dos attacks)

    I modify the function LoadPageStateFromPersistenceMedium() that translate the viewstate, and see by logging what exactly was the input, and from what IPs… then I started monitor these results and see that the view state was changed by hand – or was totally empty.

    On error I just redirect him to the same page…

    Here is what I did…

    public abstract class BasePage : System.Web.UI.Page
    {
        protected override object LoadPageStateFromPersistenceMedium()
        {
            try
            {
                .. return the base, or make here your decompress, or what ever...
                return base.LoadPageStateFromPersistenceMedium();            
            }
            catch (Exception x)
            {
                string vsString = Request.Form[__VIEWSTATE];
                string cThePage = Request.RawUrl;
    
                ...log the x.ToString() error...
                ...log the vsString...
                ...log the ip coming from...
                ...log the cThePage...
    
            // check by your self for local errors
                Debug.Fail("Fail to load view state ! Reason:" + x.ToString());
            }
    
            // if reach here, then have fail, so I reload the page - maybe here you
            // can place somthing like ?rnd=RandomNumber&ErrorId=1 and show a message
            Responce.Redirect(Request.RawUrl, true);        
    
            // the return is not used after the redirect
            return string.Empty;
        }    
    }
    

    Second Reason

    Now there is one more reason why this can happen, and the reason is because some one click on your page before the __EVENTVALIDATION is loaded.

    This eventValidation is placed on the last button-even that asp.net found, and if you have some of them on many place on the page, or near the button, then this go to the end of the page.

    So even if you see the viewstate on the top of the page, where is the Validation ??? maybe this never loaded – page corrupt ?, too fast user click on page ?

    <input type="hidden" name="__EVENTVALIDATION" id="__EVENTVALIDATION" ... >
    

    To avoid this kind of problem I made a simple javascript that I do not let it press the button unless this input have been loaded !!!.

    One more comment, the __EVENTVALIDATION is not always presents ! so is maybe safer not to search for this field if you make a general solution, but to make a javascript trick to just check if the full page is loaded, or something else that you think.

    Here is my final solution with jQuery: (note that I check on PageLoad if eventvalidation exist !). I have this placed on my MasterPages.

    <script language="javascript" type="text/javascript">
        function AllowFormToRun()
        {
            var MyEventValidation = $("#__EVENTVALIDATION");
    
            if(MyEventValidation.length == 0 || MyEventValidation.val() == ""){
                alert("Please wait for the page to fully loaded.");
                return false;
            }
    
            return true; 
        }       
    </script>
    
    protected void Page_Load(object sender, EventArgs e)
    {
        // I do not know if Page can be null - just in case I place it.
        if (Page != null && Page.EnableEventValidation)
        {
            Form.Attributes["onsubmit"] = "return AllowFormToRun();";
        }
    }
    

    You can test by placing near the button of your page a delay.

    <% System.Threading.Thread.Sleep(5000); %>
    

    Update

    Today I see in log this message again for WebResource and what I discover is that a bot getting the pages and make all the character on the links in lower case, including the parameters, so this was one more reason to not getting the correct encoded string, and throw a message like Padding is invalid and cannot be removed.

    Hope this help you more.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

No related questions found

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.